PHP/MySQL verifying the result of a query? -


i've got code should delete row, containing number database.

if ( isset($_post['textfield_numtodelete']) ) {  $numtodel = $_post['textfield_numtodelete'];  $resdel = mysqli_query( $con,"delete pncall_numbers number = '$numtodel'");  if ( $resdel ) { echo ("<center>".$numtodel." deleted successfully.</center>"); } else { echo("<center>".$numtodel." not found in database.</center>"); }  } 

if successful, should output "deleted successfully", else "not found in database". yet $resdel true, if try delete number that's not there...

thanks!

true returned because query executed, if no rows deleted. try mysqli->affected_rows after deletion


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -