I have a mysql table with a field that is bit(1) - I understand that it is 1 bit long and is either a 0 or a 1. I have managesd to read the field by wrapping the ord() around the result which is fine but I am struggling to update the field with a 0 or a 1 (TRUE or FALSE) saying that though the TRUE bit workds but I am failing to set the field to a 0 or FALSE. Below is my code.
$geteventssql2 = "SELECT * FROM events WHERE id = '".mysql_real_escape_string($_POST['workshop'])."'";
$geteventsresult2 = mysql_query($geteventssql2,$connection) or die(mysql_error());
while($geteventsrow2 = mysql_fetch_array($geteventsresult2))
{
$current_status = ord($geteventsrow['eventFull']);
print $current_status; print " - currently set";
if ($current_status == '0') {$swap = TRUE;} else if ($current_status == '1') {$swap = '0';}
//print"<script>alert ('Status has been changed');</script>";
//print"<script>document.location='ticketing.php'; </script>";
$sql = "UPDATE events SET eventFull = '".$swap."' WHERE id = '".mysql_real_escape_string($_POST['workshop'])."'";
$query = mysql_query($sql);
}
}