Above is a picture of the mysql database.
What I am trying to do is print out each entry in order according to the NewsNum. The while statement I am using just prints out each row from the first in the image to the last.
code:
$i=0;
while ($i > $num) {
//Print out news entries
$i++;
}
If anyone can come up with a better way to do it please let me know.
code:
$i=$num-1;
while ($i >= 0) {
$j=0;
while ($j != mysql_result($result,$i,"NewsNum")){
$j++;
}
echo ("<table border='0' width='421' id='table1' cellspacing='0' cellpadding='0'><tr><td width='2%' rowspan='2' background='images/border.gif'> </td><td width='2%' rowspan='2'> </td><td width='71%'><font size='1' face='Verdana'><b>");
echo mysql_result($result,$j,"NewsTitle");
echo ("</b></font></td><td width='27%'><font size='1' face='Verdana'><b>");
echo mysql_result($result,$j,"NewsDate");
echo ("</b></font></td></tr><tr><td colspan='2'><font size='1' face='Verdana'>");
echo mysql_result($result,$j,"NewsStory");
echo ("</font></td></tr></table><br>");
$i--;
}
That is how i found the way around it.