Can anyone debug this php code? Simple php. Pls.?

giridharanbtech

New member
What's wrong in here.When i exexcute the code the following error displayed.
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\glog\index.php on line 19

code:
<?php
require("connect.php");
$category_list_query = mysql_query("SELECT id,name FROM categories");
$category = array();
while($cat_list = mysql_fetch_array($category_list_query,MYSQL_ASSOC))
{
$category[$cat_list['id']]=$cat_list['name'];
}
$index_query = mysql_query("SELECT id,catid,sitename,siteurl,description FROM index");
echo "<table class='index'>";
echo "<tr>";
echo "<th>category</th>";
echo "<th>sitename</th>";
echo "<th>siteurl</th>";
echo "<th>description</th>";
echo "</tr>";
while($row = mysql_fetch_assoc(index_query))
{
echo "<tr>";
echo "<td>".$category[$row['catid']]."</td>";
echo "<td>" . $row['sitename'] . "</td>";
echo "<td>" . $row['siteurl'] . "</td>";
echo "<td>" . $row['description']. "</td>";
echo "<tr>";
}
echo "</table>";
?>
pls can anyone debug it.
 
Back
Top