1
hey guys i'm back with another problem. I think I have installed PHP, Apache and mySQL correctly coz I can get that php info table from localhost and I was able to create a table and insert values in mySQL. But when I program in php to access mySQL I get several errors.
The code I put in is pretty simple just a user login verification where username and password was supplied through a form in the previous page:
$username = $_POST['username'];
$password = $_POST['password'];
// Database Variables
$DBhost = "localhost";
$DBuser = "";
$DBpass = "password";
$DBname = "testDB";
$tableName = "user";
// Connect to database and select database $DBname.
mysql_connect($DBhost,$DBuser,$DBpass)
or die("Unable to connect to database");
mysql_select_db("$DBname")
or die("Unable to select database $DBname");
echo("connected to $DBname");
?>
The errorS I get is
Notice: Undefined index: username in C:\server\Apache2\htdocs\Website\validate.php on line 52
Fatal error: Call to undefined function mysql_connect() in C:\server\Apache2\htdocs\Website\validate.php on line 65
This is a standard connection to databases but it doesn't seem to work for me. WHY?????