How to test if a MySQL query was successful in modifying database table data?

You’re currently only checking whether the SQL statement is correctly prepared, you’re not checking whether it actually deleted the record.

Try:

...
echo ($delRecord->affected_rows > 0) ? 'true' : 'false';
$delRecord->close();

That doesn’t address whether you’re correctly checking the result string in your Javascript code – if that’s a problem we’ll need more information.

Leave a Comment