smokyyyyyy Posted December 24, 2010 Share Posted December 24, 2010 i have made function of prepare or check the mysql real escapte string but when i run this code it gives two warnings msg Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'SYSTEM'@'localhost' (using password: NO) in C:\wamp\www\cart\include\db.php on line 42 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\cart\include\db.php on line 42 kindly tell me what is this msg about how to solve it my code is 37 public function mysql_prep($value){ 38 $magic_quotes_active=get_magic_quotes_gpc(); 39v$new_enough_php=function_exists("mysql_real_escape_string"); 40 if($new_enough_php){ 41if($magic_quotes_active){ $value=stripslashes($value);} 42 $value= mysql_real_escape_string($value);} 43 else { 44 if($magic_quotes_active){$value=addslashes($value);} 45} 46 return $value; 48 } Quote Link to comment https://forums.phpfreaks.com/topic/222603-functionmysql-real-escape-string-error/ Share on other sites More sharing options...
requinix Posted December 24, 2010 Share Posted December 24, 2010 You need an open MySQL connection (like the kind mysql_connect() gives you) to be able to use mysql_real_escape_string(). It does its work according to the connection, so no connection means it can't do what it's supposed to do. Quote Link to comment https://forums.phpfreaks.com/topic/222603-functionmysql-real-escape-string-error/#findComment-1151200 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.