I've just started to run PHP and MySQl with an apache server on my home PC. I've created a PHP program to communicate with the MySQL server to access some information on the test table. However, I constantly receive this line when accessing the page:
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\query_test.php on line 7
This is the code I have used (Note, the XXXXXXXXX is the password and this line:
$connection=mysql_connect("localhost","root","XXXX XXX")
is the 7th line on my editor, and so therefore is the problematic line)
PHP Code:
<html>
<head>
<title>Query Test</title>
</head>
<body>
<?php
$connection=mysql_connect("localhost","root","XXXXXXX")
or die ("Server is down right now, due to a problem with the PHP documents communicating with the server. We should be back up soon!");
$database = "Members";
$db = mysql_select_db($database,$connection)
or die ("Server is down right now, due to a problem with the PHP documents communicating with the server. We should be back up soon!");
$query = "SELECT * FROM test";
$result = mysql_query($query)
or die ("Couldn't execute query");
mysql_close($connection);
?>
</body>
</html>
Can anyone explain to me what I'm doing wrong? I really want to be able to understand but I can't see what I'm doing wrong? Am I missing out a part of code that I need to put in?
|