Catching a mysql_error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Say i have a table with a primary key column, and i try to insert a matching
row with a PHP script. Is it possible to catch the errror number and report
this back to the user?

$query  = "INSERT INTO MyTable (Col1) VALUES ('x');
$result = @mysql_query($query);
if(mysql_error = //what do i put here){
    echo "Please choose a unique name";
}

Thanks for your help



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux