Im trying to remake my user system heres the code.
Thats my display_news.php page.
If there is nothing in the database it comes up the error message saying it.
But if there is news in the database it does not display any thing?!?
If put in
under
So that means it is going to the else but the while is not working.
Please help.
Thanks
Daniel
| Code: |
| <?
function display_news() { $news = NULL; $get_news = mysql_query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT 5"); $number_off_news = mysql_num_rows($get_news); if($number_off_news == "0") { $news .= "<td><table height='5' width='100%' cellpadding='5'><tr><td> <table width='80%' bgcolor='#F2C6C6' style='border:1px solid #B33625'> <tr> <td><b>Error:</b><br>There is currently no news in the database.</td> </tr> </table> </td></tr></table></td>"; }else{ while($news = mysql_fetch_array($get_news)) { $news .= "<td class=\"subheader\">Posted by ..........</td>"; } } echo $news; } ?> |
Thats my display_news.php page.
If there is nothing in the database it comes up the error message saying it.
But if there is news in the database it does not display any thing?!?
If put in
| Code: |
| echo "Testing..."; |
| Code: |
| $news .= "<td class=\"subheader\">Posted by ..........</td>";
} |
Please help.
Thanks
Daniel
