lundi 25 juillet 2016

PHP if/else issue using true/false

My code looks like this:

$muted = 'true'; //Note this is only for testing
if ($muted == 'false' || $muted == '' || $do_not_text == '' || $do_not_text =='false'){
//do this first thing
}
else{
//do something else
}

I can't get my else to run. What syntax am I messing up?

Related to this, I'm storing a value in my database (that will be what's called to set $muted in my real code) that's either 'true', 'false', or ''. What data type should I be storing these as? Currently, I'm using VARCHAR, but I suspect this is all part of the problem.

Aucun commentaire:

Enregistrer un commentaire