For some reason a simple database connection script that was working fine is now throwing up the following error message:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/bounce6/public_html/inf.php on line 45
The code is as follows:
include '../db_vars.php';
$connect = mysql_connect($dbhost, $dbuser, $dbpasswd) or die (mysql_error());
mysql_select_db($dbname);
echo $_GET['lodgeindex'];
if (isset($_GET['choice'])){
$choice=$_GET['choice'];
$recent_sql = "SELECT id, title, type, price, description, hire, age, adults, requirements, overnight, picture, dim, gallerypics FROM range WHERE type='$choice'ORDER BY price ASC";
$result=mysql_query($recent_sql);
while ($recent = mysql_fetch_array($result))
{
[I].... print out results[/I]
}
Line 45 is the beginning of the while statement.
Can someone tell me if there’s any problem with that PHP code, or if there’s any other reason why these errors may now have suddenly started cropping up.
From an SQL point of view, I’ve checked that the name of the table is correct and that all of the table fields are valid … and it’s still not working. Is there something else I should be checking??
Thanks very much for your help …