chriscloyd Posted November 9, 2006 Share Posted November 9, 2006 i get this error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/fragradi/public_html/Untitled-1.php on line 14 Topics RepliesWarning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/fragradi/public_html/Untitled-1.php on line 14 Topics Repliesbut from my code below i dont see an error can someone help me?[code]<?phpinclude("db.php");$catagories = mysql_query("SELECT * FROM catagories ORDER BY id ASC");while ($cats = mysql_fetch_array($catagories)) {$id = $cats['id'];$title = $cats['title'];echo '<table width="632" border="0" cellspacing="0" cellpadding="0" class="border"> <tr> <td class="header2">'.$title.'</td> <td class="header2">Topics</td> <td class="header2">Replies</td> </tr>';$forums = mysql_query("SELECT * FORM forums WHERE cid = '$id' ");while ($f = mysql_fetch_array($forums)) {$ftitle = $f['name'];$fid = $f['fid'];$description = $f['description']; echo '<tr> <td width="389">'.$ftitle.'<br>'.$description.'</td> <td width="129">'; $nt = mysql_query("SELECT * FROM topics WHERE fid = '$fid' "); $nts = mysql_num_rows($nt); echo $nts; echo '</td> <td width="114">'; $nr = mysql_query("SELECT * FROM replies WHERE fid = '$fid' "); $nrs = mysql_num_rows($rt); echo $nrs; echo '</td> </tr></table><br>';}}?>[/code] Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted November 9, 2006 Share Posted November 9, 2006 there may not be any data in the table. do a mysql_num_rows if statement to check if there is any forums. if there isnt, then display a message like: No forums in this category. if there is then do the while loop. Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 9, 2006 Share Posted November 9, 2006 Well, I don't know about you guys, but I've never hear of the "FORM" operator in a SQL query!Try changing that to "FROM" and you might get better results (pun intended). ;) Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted November 9, 2006 Share Posted November 9, 2006 hah. yeh i didnt notice that. shows how much i pay attention to the code. good eyes. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.