php - mysql_real_escape_string() say Access denied for user 'drrifae'@'localhost' -


i userd mysql_real_escape_string(), ok on localhost (on computer run xampp) when upload linux server function (mysql_real_escape_string()) access denied user 'drrifae'@'localhost'

this code:

  if($_post['message']!=""){         $email=$_post['email'];         $name=$_post['name'];         $message=mysql_real_escape_string($_post['message']);        $ip=$ip = getenv('http_client_ip')?: getenv('http_x_forwarded_for')?: getenv('http_x_forwarded')?: getenv('http_forwarded_for')?: getenv('http_forwarded')?: getenv('remote_addr');  include('../include/connection.php'); $sql="insert `contact_feedback` (`type`, `ip`, `message`, `name`, `email`) values ('$type', '$ip', '$message', '$name', '$email'); ";         $result=mysql_query($sql,$con) or die(mysql_query());         if($result){             echo $_session['message']='true';                 $mailmessage=wordwrap($message,70);                 $mailmessage.='\n \n'.$email.'\n'.$name.'\n \n'.$ip;             if($type=='1'){                 $subject="contact";             }else if($type=='0'){                 $subject="feedback";              }             mail('info@rifae.com',$subject,$mailmessage,$email);         }else{             $_session['message']='false';         }     } 

but can't use mysql_real_escape_string()

$message=mysql_real_escape_string($_post['message']); //... include('../include/connection.php'); 

you use mysql_real_escape_string() before include connection - why have no access.


also keep in mind mysql_* functions officially deprecated , hence should not used in new code. can use pdo or mysqli instead. see this answer on so more information. (if follow links in post, you'll find tutorials on how use either).


mysql_ neither mysqli nor pdo, should able see available via phpinfo().


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -