Re: [PHP] Error codes from 'mysql_error()'
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Dennis Gearon) wrote: > I do an insert using phpadmin, and i get back the error message (or > maybe it's a warning?) The insert is of a duplicate on a unique field. I > expected an error, but when I do mysql_error() or mysql_errno(), nothing > comes back(and I do it the next line in the script). the > 'mysql_query($sql, $link)' function DOES insert when the value is > unique, DOES return false, but I'd like to inform the user what the > error was. PHP Admin can get the 'error' why can't I? Where are the calls placed? mysql_error() or mysql_errno() can only be used after a valid mysql connection has been established, so for instance this will not return an error message from mysql: mysql_connect(stuff) or die(mysql_error()); -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Error codes from 'mysql_error()'
mysql_query($sql) or die("there was an error: ".mysql_error()); -aaron At 3:16 PM -0800 3/8/01, Dennis Gearon wrote: >I do an insert using phpadmin, and i get back the error message (or >maybe it's a warning?) The insert is of a duplicate on a unique field. I >expected an error, but when I do mysql_error() or mysql_errno(), nothing >comes back(and I do it the next line in the script). the >'mysql_query($sql, $link)' function DOES insert when the value is >unique, DOES return false, but I'd like to inform the user what the >error was. PHP Admin can get the 'error' why can't I? > >Please reply to me as well, OK? I'm trying to finish this script at work >today. >[EMAIL PROTECTED] > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Error codes from 'mysql_error()'
I do an insert using phpadmin, and i get back the error message (or maybe it's a warning?) The insert is of a duplicate on a unique field. I expected an error, but when I do mysql_error() or mysql_errno(), nothing comes back(and I do it the next line in the script). the 'mysql_query($sql, $link)' function DOES insert when the value is unique, DOES return false, but I'd like to inform the user what the error was. PHP Admin can get the 'error' why can't I? Please reply to me as well, OK? I'm trying to finish this script at work today. [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]