I am using PHP Version 5.1.4 and am trying to catch an exception if there are issues with the SQL query.
Just like this :
However it's not happening. I am still getting error :PHP Code:try {
odbc_exec($DB,$sql);
print("<center><font color=\"green\">User Created</font></center>");
}
catch (RuntimeException $e) {
print("Exception cought");
}
Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY constraint 'PK_logins'. Cannot insert duplicate key in object 'logins'., SQL state 23000 in SQLExecDirect in D:\WebRoot\Jupiter\admin\admin\addModifyDelete.php on line 72.
Do I have to enable something in my ini file or do I have to declare that I am going to catch exceptions in this script or am I missing something simple?
Thanks


Reply With Quote

Bookmarks