I am trying to connect to mySQL database using this code, but I always get an error saying
Fatal error: Uncaught Error: Call to undefined function mysql_connect()
here is my code;
<?php
$servername = "";
$user = "";
$pwd = "";
$dbname = "";
function connexion()
{
global $servername, $user, $pwd, $dbname;
$db=mysql_connect($servername,$user,$pwd) or die("Database connection failed: ".mysql_error());
mysql_select_db($dbname,$db);
}
?>
The point is to call for the function connecxion()
after the user enter the right inputs. Can you tell me what I am doing wrong please?