Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal error: Uncaught Error: Call to undefined function mysql_connect()

Tags:

php

mysql

xampp

I am trying to do a simple connection with XAMPP and MySQL server, but whenever I try to enter data or connect to the database, I get this error.

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

Example of line 22:

$link = mysql_connect($mysql_hostname , $mysql_username); 
like image 591
Demeteor Avatar asked Jan 03 '16 16:01

Demeteor


People also ask

What is uncaught error call to undefined function mysql_connect ()?

If you get an error like Fatal error: Call to undefined function mysql_connect() when trying to install GFI HelpDesk, it probably means that MySQL support has not been enabled for PHP on your server (that is, the PHP module php-mysql has not been installed).

What is uncaught error in PHP?

When an exception is thrown, the code following it will not be executed, and PHP will try to find the matching "catch" block. If an exception is not caught, a fatal error will be issued with an "Uncaught Exception" message.


1 Answers

mysql_* functions have been removed in PHP 7.

You probably have PHP 7 in XAMPP. You now have two alternatives: MySQLi and PDO.

like image 61
efik Avatar answered Sep 20 '22 16:09

efik