marklarah Posted January 29, 2008 Share Posted January 29, 2008 <td bgcolor="darkgreen"><font color="white" align="center"><center>Recent Posts</center></font></td></tr> <?php $resultll="SELECT * FROM `topics` ORDER BY lpt DESC LIMIT 5"; $articlesll = mysql_query($resultll) or die(mysql_error()); $rrow = mysql_fetch_array($articlesll); while ($rrow = mysql_fetch_array($articlesll)){ $rtopic = $rrow['name']; ?> <tr> <td><? echo $rtopic; ?>hi</td></tr> <? } ?> </table> It just echos hi....4 times rather than 5 Link to comment https://forums.phpfreaks.com/topic/88469-solved-noob-errorbut-help-my-php-lookup/ Share on other sites More sharing options...
cooldude832 Posted January 29, 2008 Share Posted January 29, 2008 I don't see a limit saying it will do it 5 times I see a limit of a max of 5 times maybe you only have 4 rows in your table Link to comment https://forums.phpfreaks.com/topic/88469-solved-noob-errorbut-help-my-php-lookup/#findComment-452861 Share on other sites More sharing options...
GingerRobot Posted January 29, 2008 Share Posted January 29, 2008 Remove this line: $rrow = mysql_fetch_array($articlesll); You should not make a call to any of the mysql_fetch_xxx functions prior to using them in a loop. When you call this function, you move the pointer forward. Next time it's called, it points to the second row in the returned result. Link to comment https://forums.phpfreaks.com/topic/88469-solved-noob-errorbut-help-my-php-lookup/#findComment-452862 Share on other sites More sharing options...
marklarah Posted January 29, 2008 Author Share Posted January 29, 2008 well it echos 5 times now as it should, but it still only echos hi. Link to comment https://forums.phpfreaks.com/topic/88469-solved-noob-errorbut-help-my-php-lookup/#findComment-452864 Share on other sites More sharing options...
themistral Posted January 29, 2008 Share Posted January 29, 2008 Does the field 'name' exist in the table 'topics'? Link to comment https://forums.phpfreaks.com/topic/88469-solved-noob-errorbut-help-my-php-lookup/#findComment-452871 Share on other sites More sharing options...
marklarah Posted January 29, 2008 Author Share Posted January 29, 2008 im not THAT noobish Link to comment https://forums.phpfreaks.com/topic/88469-solved-noob-errorbut-help-my-php-lookup/#findComment-452875 Share on other sites More sharing options...
marklarah Posted January 29, 2008 Author Share Posted January 29, 2008 but i am noobish enough to forget case...... ;D Link to comment https://forums.phpfreaks.com/topic/88469-solved-noob-errorbut-help-my-php-lookup/#findComment-452876 Share on other sites More sharing options...
GingerRobot Posted January 29, 2008 Share Posted January 29, 2008 That was my next question. Dont worry though, tis always the small things that catch you out. Link to comment https://forums.phpfreaks.com/topic/88469-solved-noob-errorbut-help-my-php-lookup/#findComment-452877 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.