Warning: mysql_real_escape_string()
Posted: Thu May 01, 2008 4:43 am
Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/gaogier/mysql_connect.php on line 11 pops up every time i try and update my database
Code: Select all
<?php
$dbh=mysql_connect ("localhost", "USER", "PASS") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("DATABASE");
function escape_data ($data){
global $dbh;
if (ini_get('magic_quotes_gpc')){
$data = stripslashes($data);
}
return mysql_real_escape_string (trim ($data), $dbh);
}
?>