0
$con=mysql_connect('localhost','saveerjain','password') or die(mysql_error());

I am getting an error on this line in my register.php file when I run it.

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\login\register.php:49 Stack trace: #0 {main} thrown in C:\xampp\htdocs\login\register.php on line 49

Paul T.
  • 4,015
  • 11
  • 22
  • 27
Smartsav10
  • 123
  • 8
  • https://stackoverflow.com/questions/13825108/undefined-function-mysql-connect refer this link maybe this will solve your issue. – Rudra Dec 13 '20 at 14:30
  • Depending on the version of PHP running, the pure mysql feature can be removed from it for security purpose. You should use mysqli or pdo. Which PHP version are you using ? – LeviathanCalumet Dec 13 '20 at 14:32
  • I don't know- It just says .php. I am using the Sublime Text Editor and running it in my localhost through Xampp and Apache. – Smartsav10 Dec 13 '20 at 14:34
  • this function was removed since PHP 7. take a look here: https://www.php.net/manual/en/function.mysql-connect.php. you need to use PDO – vlad katz Dec 13 '20 at 14:41
  • Somewhere it tells you the PHP version. Google "how to find PHP version xampp" and then follow instructions. – ADyson Dec 13 '20 at 14:51
  • Problem Solved, thanks to Rudra Thakkar, LeviathanCalumet, vlad katz, and ADyson. I needed to change all my mysql functions to mysqli. That solved this error, then I got a couple more on other lines that I solved and can help anyone who is needing it. – Smartsav10 Dec 13 '20 at 14:59

0 Answers0