I'm rather new to PHP, and I want to:
- define a class in the main directory of my web application and use it in sub-directories.
- the class receives MySQL delete statements, executes them and catches foreign key constraint exception.
This is the class so far:
class MySQLErrorHandling
{
public function query($query_string)
{
try
{
$conn = mysql_query($query_string);
if (!$conn)
throw new Exception("mysql Error:");
}
catch(Exception $e)
{
echo $e->getMessage(). mysql_error();
}
}
}
Any suggestions? Appreciated.