Please debug this php script...?

giridharanbtech

New member
Whats wrong in this script. Whenever i execute the following msg is displayed.
"cannot select index db".
I connected my db properly and also i insert values but cannot get it. Pls help me
<?php
$dblink = mysql_connect("localhost","root","");
mysql_select_db("girilog",$dblink);
$query = "SELECT id,name FROM categories";
$category_list_query = mysql_query($query) or die("unable to select category db");
$category = array();
if($category_list_query)while($cat_list = mysql_fetch_array($category_list_query))
{
$category[$cat_list['id']]=$cat_list['name'];
}
$index_query = "SELECT sitename,siteurl,description FROM index";
$index_query1 = mysql_query($index_query) or die("cannot select index db");
while($indexresult = mysql_fetch_array($index_query1))
{
$indexnumrows = mysql_num_rows($indexresult);
}
if($indexnumrows == 0)while($indexresult = mysql_fetch_array($index_query1))
{
echo "<table width='300px'><tr><td>No topics!</td></tr></table>";
}
else {

echo "<table class='index'>";
echo "<tr>";
echo "<th>category</th>";
echo "<th>sitename</th>";
echo "<th>siteurl</th>";
echo "<th>description</th>";
echo "</tr>";
if($index_query)while($row = mysql_fetch_assoc($index_query))
{
print "<tr>";
print "<td>".$row['catid']."</td>";
print "<td>" . $row['sitename'] . "</td>";
print "<td>" . $row['siteurl'] . "</td>";
print "<td>" . $row['description']. "</td>";
print "<tr>";
}
echo "</table>";
}
?>
 
Back
Top