Hi guys.
I am using this custom mysql query function, for two current purposes:
1) To send an error report if the query fails (and show a nice message - yep, there's controls to ensure the same error isn't submitted twice to avoid floods)
2) To count the amount of SQL queries on each page
function mysql_custom($sql)
{
$GLOBALS['queryCount']++;
if ($res = mysql_query($sql)) {
return $res;
} else {
// We send an error report here if it fails, and display a nice error
}
}
I was wondering however, as I use mysql_real_escape_string() on pretty much every $POST and $GET throughout my site that has any SELECT, UPDATE, INSERT, DELETE sql query... could I make that above function do it instead? That way I can get rid of tonnes of code from my individual.php functions and let that simple function do it itself?
Just wondering,if it can be done, what's the best method?
Thanks!