What i am trying to do is change a value on a button press
Ie, Press the button and the value changes from 0 to a 1 one or Press the button and the value goes to a 1 from a 0.
and on and on. I am struggling on this part.
<?php
include ('db.php');
$conn = mysqli_connect("BLAH CONNECTION");
$result = mysqli_query($link, "SELECT * FROM on_offsurvey");
while($row = mysqli_fetch_array($result)){
$status = $row["site_status"];
echo $status;
}
if ($status == 1) {
$sql = "update on_offsurvey set site_status=0 where id=0)";
} else if ($status == 0) {
$sql = "update on_offsurvey set site_status=1 where id=0)";
}
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
}
?>
That part i am struggling on is the If/If else statement that controls my 0 to 1 or 1 to 0
Any help ?
Aucun commentaire:
Enregistrer un commentaire