Jump to content

Recommended Posts

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 }

Link to comment
https://forums.phpfreaks.com/topic/222603-functionmysql-real-escape-string-error/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.