Forum Moderators: open

Message Too Old, No Replies

Reviewing mySQL transaction errors?

         

sun818

7:53 pm on Oct 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I am having difficulty troubleshooting an issue where I think my PHP script is not able to insert data to a mySQL database. Is there a text log somewhere for mySQL that would indicate specific reasons like login errors, privilege error, etc on why a transaction to the database failed?

Birdman

8:19 pm on Oct 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can use PHP's mysql error function to spit out the problem.

$result = mysql_query('mysql commands here') or die( mysql_error() );

sun818

8:33 pm on Oct 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi Birdman, thanks for your reply. I understand the concept, but I'm not a programmer and don't know how to change a script to test it. I just bought one online that suits my purpose.

Birdman

8:50 pm on Oct 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You may also add a line at the top of your script(after the <?php line) to debug. Any errors should output to the browser when you run the script.

<?php
error_reporting(E_ALL);
...

That may help give you an idea of what's going wrong.