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

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -