Hi all,
I have a page that list news stories by the day ( I have a field called 'Day' and it is an enum with 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday' in it).
And I loop thru and start to display the results based on what today is (ie today is Thursday and show the results for Thursday - (last) Friday.
I am trying to wrap my brain around how to test my results from a query, so here is what I am 'trying' to do...
Example:
Thursday
-->Article 1
-->Article 2
Wednesday
-->Article 1
Tuesday
-->Article 1
-->Article 2
-->Article 3
-->Article 4
Monday
-->Article 1
Friday
-->Article 1
Here is my attempt...
<table>
$x=0;
while ($row = mysql_fetch_array($result)) {
$ID = $row['ID'];
$Quote = $row['Quote'];
$Source = $row['Source'];
$Day = $row['Day'];
// HTML <tr>
//HTML <td>
if ($x ==0) {
echo $Day; // Show me the Name of that day from table
} else {
echo 'nothing';
}
//echo the article
$x = $x++; // incement x so it will not display the Day name next loop
echo $Quote. ' '.$Source;
} //close out the while loop
What I am getting is ...
Example:
Thursday
Friday
Friday
Monday
Wednesday
Tuesday
With no articles???
I know I am coding this wrong in several ways.
1) No articles
2) multiple day names
3) Days in wrong order.
Here is the link to my page...
The page on my testing server.
And zip file of the complete page...
A zip of my page.
Thanks in advance,
Don