When i run my php file with the following code:
<?php
//configurution of server
$serve = mysql_connect('localhost', 'root', 'password');
if (!$serve) { echo 'error' ; }
$db = mysql_select_db('record', $serve);
//action to include
if($_GET['action'] == 'include') {
$name = $_GET ['name'];
$lastname = $_GET['lastname'];
$SQL = "insert into user (name, lastname) VALUES ('$name', '$lastname')";
$re = mysql_query($SQL, $serve);
}
//action list
if($_GET['action'] == 'userlist') {
$SQL = "SELECT * FROM user";
$re = mysql_query($SQL, $serve);
$num = mysql_num_rows($re);
if($num > 0) {
//view screen
while ($Line = mysql_fetch_object($re)) {
echo "<b>Name: </b> {$Line->name} <b><br></b>
<b>Lastname: </b> {$Line->lastname} </br><hr>";
}
}
else {
echo 'no user recorded';
}
}
?>
This error appears: Fatal error: Call to undefined function mysql_connect() in C:\xampp\htdocs\xampp\record\www\connect.php on line 5
I have ran the php file below to check my extension list to see if '[xx] => mysql' is displayed which it isn't. I have added 'extension=php_mysql.dll' to 'php.ini' and restarted apache & mysql but this still isn't working. I have also added 'C:\xampp\php\ext' into the 'path' environmental variable. I have checked the internet but can't seem to find a solution to my problem, can anyone please help me. Thank-you.
<?php // extensions_list.php
$list = get_loaded_extensions();
$list2 = array_map('strtolower',$list);
sort($list2);
echo '<pre>'.print_r($list2,true).'</pre>';
?>