I have problem. like this, this code DELETE FROM guru WHERE id=2
return true when in database mysql
. only there data with id=1 in mysql
. should return false because id=2 in syntax above. so I confuse, help me please. I'm sorry my English less fluent.
The DELETE
operation will be successful if the syntax is correct and the table guru
exists in the database you're connected to. A false
is what happens specifically when a query encounters an error and requesting a deletion on rows that don't exist is not an error.
What you want to do is check how many rows were affected by your query, as if that's zero then it didn't do anything.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With