We have tried this simple script but it still will not connect to the databases even though it has connected to mysql OK.
Is there any obvious reason? Is the script wrong or is it likely that there is a problem with mysql and its configurations?
<body>
<?php
//The values below have been removed for security
$db=mysql_connect($host,$user,$password);
mysql_select_db("test",$db);
$result=mysql_query("SELECT * FROM employees",$db);
printf("First Name: %s<br>\n", mysql_result($result,0,"first"));
printf("Last Name: %s<br>\n", mysql_result($result,0,"last"));
printf("Address: %s<br>\n", mysql_result($result,0,"address"));
printf("Position: %s<br>\n", mysql_result($result,0,"position"));
?>
</body>
This is the type of error that we are getting:
Warning: Supplied argument is not a valid MySQL result resource in xxx/xx/test.php on line xx
First Name:
Please help,
Thank you for your help.
XXX