I have this weird situation where my query isn't doing what it's supposed to do.
Here is my not working code:
$aanbodID = 1;
$getData = mysql_query("SELECT boekbaar_iframe FROM tbl WHERE id_aanbod= $aanbodID");
while ($row_content = mysql_fetch_array($getData))
{
$zichtbaarjanee = $row_content['boekbaar_iframe']; // 0 or 1
}
$nieuwewaarde = 0;
if ($zichtbaarjanee == 0)
{
$nieuwewaarde = 1;
}
mysql_query("UPDATE aanbod_20160206 SET boekbaar_iframe = ".$nieuwewaarde." WHERE id_aanbod = ".$aanbodID."");
echo mysql_error();
And here is almost the same code that is working:
$aanbodID = 1;
$getData = mysql_query("SELECT boekbaar_iframe FROM tbl WHERE id_aanbod= $aanbodID");
while ($row_content = mysql_fetch_array($getData))
{
$zichtbaarjanee = $row_content['boekbaar_iframe']; // 0 or 1
}
//switch these vars and its working
$nieuwewaarde = 0;
// $nieuwewaarde = 1;
mysql_query("UPDATE tbl SET boekbaar_iframe = ".$nieuwewaarde." WHERE id_aanbod = ".$aanbodID."");
echo mysql_error();
So i'm guessing the problem is somewhere in the if statement, but i've tried everything, also with and without ' ' or " ".
Please help!
Aucun commentaire:
Enregistrer un commentaire