Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- mysql real escape string deprecated?


brokaddr - 10:48 pm on Sep 21, 2012 (gmt 0)


The connections are setup as follows:
$$link = mysqli_connect($server, $username, $password, $database);

Everything seems to work, except these errors keep showing up in error-log:
[21-Sep-2012 22:42:05 UTC] PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /home/**/public_html/**/database-mysqli.php on line 138
[21-Sep-2012 22:42:08 UTC] PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /home/**/public_html/**/database-mysqli.php on line 138


1 error for each click I do.

Line 138:
return mysqli_fetch_array($db_query, $type);


The full function:
function tep_db_fetch_array($db_query, $type=MYSQLI_ASSOC) {
return mysqli_fetch_array($db_query, $type);
}



So, I tried this and I don't appear to be getting anymore errors - is this a proper way to handle this?
function tep_db_fetch_array($db_query, $type=MYSQLI_ASSOC) {
if ($db_query){
return mysqli_fetch_array($db_query, $type);
}
}


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/4466499.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com