darklight Posted October 24, 2007 Share Posted October 24, 2007 This keeps returning nothing back... $getnews = mysql_query("SELECT * FROM `news` ORDER by id"); $newsnum = mysql_num_rows($getnews); if ($newsnum <= 0) { echo ("There is no news at the moment."); } else { $news = mysql_fetch_array($getnews); while ($news = mysql_fetch_array($getnews)) { echo " <center> <table width=\"550\" border=\"1\" cellspacing=\"0\" cellpadding=\"1\"> <caption> Date: $news[date] </caption> <tr> <td>$news[content]</td> </tr> </table> </center>"; Quote Link to comment https://forums.phpfreaks.com/topic/74543-solved-need-some-help-grabbing-from-mysql/ Share on other sites More sharing options...
trq Posted October 24, 2007 Share Posted October 24, 2007 Can't even read that Im afraid. Lets format it so its readable and add some debugging. <?php $sql = "SELECT * FROM `news` ORDER by id"; if ($result = mysql_query($sql)) { if (!mysql_num_rows($result)) { echo "There is no news at the moment."; } else { while ($news = mysql_fetch_array($result)) { echo " <center> <table width=\"550\" border=\"1\" cellspacing=\"0\" cellpadding=\"1\"> <caption> Date: {$news['date']} </caption> <tr> <td>{$news['content']}</td> </tr> </table> </center>"; } } } else { echo mysql_error() . "<br />$sql"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/74543-solved-need-some-help-grabbing-from-mysql/#findComment-376777 Share on other sites More sharing options...
darklight Posted October 24, 2007 Author Share Posted October 24, 2007 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/74543-solved-need-some-help-grabbing-from-mysql/#findComment-376784 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.