PHP mysql returns bool(true) even when field is not in table? -
$sql = "update prelaunch set email_verified = true email_verification_link = '$ckey' , email_verified = '0'"; $res = mysqli_query($con, $sql); var_dump($res);
bool(true)
var_dump when email_verification_link
not valid key in table...? update email_verified
value 1 if email_verification_link
key valid.
when key not valid still returns bool(true)
.. how can check if key valid before updating table in single sql statement?
returning true
means query succeeded. returning false
means query failed. finding no rows not failure. failures things broken sql syntax means query can't run.
instead, check mysqli_affected_rows
function:
$rows = mysqli_affected_rows($con);
Comments
Post a Comment