In order to safeguard against SQL injection attacks as well as make my code more portable, I created special wrapper functions for the SQL stuff I need, EG:
Code: Select all
function dbescape( $value )
{
return mysql_real_escape_string( $value );
}
function diesql()
{
die(mysql_error());
}
function dbselect($table,$field,$value)
{
$q = mysql_query("SELECT * FROM ".$table." WHERE ".$field."='".dbescape($value)."'") or diesql();
return $q;
}
function dbnumrows($x)
{
return mysql_numrows($x);
}Code: Select all
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in phpfuncs.php on line 44So the question is, is there a way to modify it so it tells me something about who called the function... EG, the above warning might become:
Code: Select all
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in phpfuncs.php on line 44, called by submit.php on line 250