Echo MySQL error

conor

New Member
I have a database connection that was previously working and now isn't. How can i echo the MySQL error so that it tells me whats wrong? As far as i know the error message should be displayed because of line 5?

Heres a link to the page: http://www.todhchai.org/contactus.php#mailing_list

Here is the db.php file:

(I have taken out the correct connection details)

1.<?php
2.
3.$link = mysql_connect('localhost', 'wherever', 'wouldn't-you-like-to-know!');
4.if (!$link) {
5. die('Could not connect: ' . mysql_error());
6.}
7.mysql_select_db('list');
8.?>

Is it possible that i might have somehow overwritten line 5 in with the "user friendly" error message that i have set up in the contactus.php file? If you need access to the contactus.php file just ask.
 

jnjc

New Member
Try adding the follow at the top of your PHP File:

Code:
<?php
error_reporting(E_ALL);

This might shed some light
 

conor

New Member
yeah i tried that and it worked locally, on my machine, but when i uploaded the db.php file with the changes it didn't display any errors. I have therefore concluded that it must be a problem with my contactus.php file. I'll get someone to have a look at it for me.

Thanks
 
Top