sasnaktiv
asked on
How to create a $variable from a mysql_error()
Hi Guys,
Is there a way to capture the results of a mysql_error()) into a variable such as $mysql_error = "???";?
I want to state what the error is in my own words.
Thanks,
Sas
Is there a way to capture the results of a mysql_error()) into a variable such as $mysql_error = "???";?
I want to state what the error is in my own words.
Thanks,
Sas
mysql_query("UPDATE table SET column1=something") or die(mysql_error() );
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, I can work with that code. It gives me the actual error message which allows me to address each error uniquely.
Have a good weekend,
Sas
Have a good weekend,
Sas
Secondly, error() function in mysqli (or mysql_error() function in mysql) is useful to debug your script, in order to get the exact error infos. In production server is a security issue to show mysql and php messages to the users and you can safely replace them with another error message:
Open in new window