0

I am having trouble looking around the web for converting code in php 5.6 to 8.2. This is the first problem I have run into while testing. It gives this error: Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in ... Stack trace: #0 {main} thrown. I have tried looking around and fixing it but its not really working. Here is the section it is throwing it up on: $UU2 = $_POST["username"]; $PP = $_POST["password"];

$UU2 = mysql_real_escape_string($UU2); $PP = mysql_real_escape_string($PP);

$q = "SELECT * FROM users WHERE username= '$UU2' AND password= '$PP' AND divisionnum != '15' LIMIT 1";

I have also played around with the different ' " and removed them, but no change, declared the $UU2 earlier, and looked up the updated mysql_real_escape_string and tried to replicate.

  • `mysql_real_escape_string` is long deprecated. (if I remember correctly, only PHP 4 and 5 support this function and it was removed in subsequent PHP versions) – Ken Lee May 09 '23 at 16:46
  • The whole extension was removed years ago, after a long deprecation process. You can try a [shim](https://github.com/dshafik/php7-mysql-shim) or just take the time to move to PDO and use prepared statements. – Álvaro González May 09 '23 at 18:08

0 Answers0