The problem stems from Wampserver's demo SQL files which include mysql_*
based functions code.
Sidenote: They really should make a note of that or update their demo files to include test files containing mysqli_
and/or PDO code to leave out the confusion, since the version of PHP that comes with it is 5.5.12, which would only make sense.
I myself have recently installed Wamp in one my machines a few weeks ago and was faced with the very same issue, yet I quickly remedied the situation by simply changing all instances of mysql_
to mysqli_
and setting the DB connection variable as the first parameter.
For example and taken from http://php.net/manual/en/function.mysqli-connect.php
$result = mysqli_query($link, $query); // $link being the connection variable
This is what their demo SQL code looks like:
<?php
$link = mysql_connect('hostname','dbuser','dbpassword');
if (!$link) {
die('Could not connect to MySQL: ' . mysql_error());
}
echo 'Connection OK'; mysql_close($link);
?>
Change it to the following as an example and changing the proper code for your own DB:
<?php
$link = mysqli_connect('hostname','dbuser','dbpassword','db_name');
if (!$link) {
die('Could not connect to MySQL: ' . mysqli_error($link));
}
echo 'Connection OK'; mysqli_close($link);
?>
For more information on mysqli_
and PDO, visit the following pages:
Additional links:
which are much better and safer to use when getting into database work.