Hi folks
This code does not produce an error, trouble is it does not produce anything at all. All it is supposed to do is to connect to a database on my ISP's server via PHPAdmin and return the 7 or 8 records I put in trhe vacancies table yesterday. - Any ideas............................anyone please
I have tried it on localhost too with exactly the same result, so at least whatever it is doing is at least consistent, trouble is what is it doing, when all the text books say it should be connecting and returning records.
I am beginning to think there is either something wrong with the MySQL installation at my/my ISP's server.
TIA John
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="description" content="Recruitment"/>
<meta name="keywords" content="Recruitment">
<meta name="author" content="John W."/>
<title>Warwickshire Mobile Computer Repair Service</title>
</head>
<body>
<?php # - mysql_connect.php
define ('DB_USER','USERNAME');
define ('DB_PASSWORD','PASSWORD');
define ('DB_HOST','HOST');
define ('DB_NAME','DB');
$dbc = @mysql_connect (DB_HOST,DB_USER,DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error());
mysql_select_db (DB_NAME) OR die ('Could not select the database' . mysql_error());
$query="SELECT * FROM vacancies";
$result = mysql_query ($query);
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
echo "Name :{$row['Ref']} <br>";
}
mysql_close();
?>
</body>
</html>
Bookmarks