-
-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to check result after update()? #4138
Comments
The SQL methods like You can then retrieve the exact error using methods like Example: if(!$sql->update($update_query))
{
$sqlError = $sql->getLastErrorText();
return $sqlError;
} Or in your example You could check I personally think it is best to check for the result of running the query, so checking if $result is false or not. Then if it is false, retrieve the actual SQL error. |
I spent 2 hours debugging, so I know that this Now you need to use I don't need to know the exact error. There is no bug, everything is OK, I just wanted to be sure that I am on right track - to check 0 vs false. |
Ah right, I did this without checking the actual code but using |
There are 3 possible results:
I noticed that you are testing $sql->getLastErrorNumber() to detect if there is change or not (in news)
but it looks to me that there is an easier way too:
value 0 - no changes
value false - error
Correct?
Tested with this code:
and with this too.
But I wanted to confirm this. So what is correct? test return value after update or getLastErrorNumber() ?
Thanks
The text was updated successfully, but these errors were encountered: