I am trying to insert boolean values into mysql table through PHP Script.
Here is my code:
$id = "104"
$bool1 = true
$bool2 = false
$sql = "INSERT INTO Monday SET Id = '$id' , morning = '$bool1' , night = '$bool2' " ;
//Store the result in $result
$result = $conn->prepare($sql) ;
// Get the result in a Returnvalue var
if (!$result) {
throw new Exception($result->error);
}
$result->bind_param("sii" ,$patientId , $morning , $night );
$returnValue = $result ->execute();
return $returnValue ;`
In MYSQL table structure
morning and night both are of type BOOLEAN (tinyint(1))
When I execute this code true and false both inserts value '0' .
$bool1and$bool2var_dump($bool1);andvar_dump($bool2);