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] Link to comment https://forums.phpfreaks.com/topic/26663-creatin-my-own-forums/ 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. Link to comment https://forums.phpfreaks.com/topic/26663-creatin-my-own-forums/#findComment-121980 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). ;) Link to comment https://forums.phpfreaks.com/topic/26663-creatin-my-own-forums/#findComment-121993 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. Link to comment https://forums.phpfreaks.com/topic/26663-creatin-my-own-forums/#findComment-122006 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.