Strange DB Error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When returning to the main page of my script sometimes I'll get the following error:

Warning: mysql_fetch_array(): 8 is not a valid MySQL result resource in /home/nick/http/search/includes/main.inc on line 13

This happens only AFTER the first element in the resource has been processed. Here's the code that is causing the problem:

$s = mysql_query("SELECT * FROM categories WHERE length(cat)='2'");
while($t = mysql_fetch_array($s)){
$cat = $t["cat"];
$name = $t["name"];
if($tstruc == $dirwidth){
echo "</tr><tr>";
$tstruc = 0;
}
echo "<td align=\"left\" valign=\"top\"><font face=\"verdana,sans serif,helvetica\" size=\"3\"><b><a href=\"index.php?index=directory.inc&cat=$cat&name=$name&depth=0\">$name</a></b></font>";
$subcat = mysql_unbuffered_query("SELECT * FROM categories WHERE length(cat)='4' && substring(cat,1,2)='$cat' ORDER BY cat");
while($ct = mysql_fetch_array($subcat)){
$scats = $ct["name"];
$dcats = $dcats . $scats . ", " ;
}
$dcats = trim(substr($dcats, 0, 28)) . trim("...");
if($dcats != "..."){
echo "<br><font face = \"tahoma,sans serif,helvetica\" size=\"1\">" . $dcats . "</font>";
}
$dcats = "";
echo "</td>";
++$tstruc;
}


You can go to the site http://www.icesource.com to see this script in action. This is an intermittent problem so you may not see it at the site, but it does happen there sometimes. If you click on one of the categories on the list there, and to two or three deep, then hit the Home link at the top left of the listings there's a pretty good chance you'll see the problem. I've been trying to figure this out for a long time, and nothing seems to work. Any ideas out there would be greatly appreciated.

Nick

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux