The following Example might help you in understanding mysql_error():
mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error())
This will return an error if there is a problem connecting to your MySQL database
$value = mysql_query($your_query) or die("A MySQL error has occurred.<br />
Your Query: " . $your_query . "<br />
Error: (" . mysql_errno() . ") " . mysql_error())
When you encounter an error, this will return your custom message (A MySQL error has occurred.<br />) followed by a line number, and the actual error.