Warning: mysqli_real_escape_string

Asked

Viewed 28 times

0

Hello, I have a question! I got a PHP code of Access to panel using User and password for study. At one point it was necessary to switch to mysqli_connect. With this change I made many changes to the code. One of it was turn to mysqli_real_escape_string, where when trying to connect to the panel appears this error:

Warning: mysqli_real_escape_string() expects Exactly 2 Parameters, 1 Given in /

I studied the documentation of mysqli_real_escape_string and noticed that it is necessary to put the connection parameter, which in my case is $connects. The same didn’t work.

Can you help me? This way I can study over my mistake: I followed part of the Code:

$theValue = function_exists("mysql_real_escape_string") ? mysqli_real_escape_string($theValue) : mysql_escape_string($theValue);

Grateful for the help Carlos Louvato

  • Your hypothesis that the connection parameter is missing is correct. It probably didn’t work because you did something else wrong or made a mistake in their order. You can ask the question as you did?

  • $theValue = function_exists("mysql_real_escape_string") ? mysqli_real_escape_string($connects, $theValue) : mysql_escape_string($connects, $theValue);

  • Next error: Warning: mysqli_real_escape_string() expects Parameter 1 to be mysqli, null Given in /

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.