I have an int field in database and :disabled is supposed to be true false, I am assuming database gets boolean values as integer 0 and 1, but I am unsure.
function loadbyinput($name,$password,$ipnumber="0.0.0.0",$type="member",$disabled=FALSE){
$dbh = new PDO(...);
$statement=$dbh->prepare("insert into
actor(name,password,ipnumber,type,disabled)
values(:name,:password,:ipnumber,:type,:disabled)");
$statement->bindParam(":disabled", $disabled);
}
I am not writing any GUI at the moment so it is hard to test such things for me.
The equivalents get passed:
True = 1
False = 0
Depends on your schema. For boolean columns in the database you can use the following construct (there is a BOOLEAN construct, but it's just an alias for TINYINT):
`disabled` tinyint(1) NOT NULL DEFAULT '0'
Then when you bind, you can enforce a bool value:
$stmt->bindValue(':disabled', $disabled, PDO::PARAM_BOOL);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With