Ok so I have a database table with dates in them….there are 3 fields in the table that I want to pull dates from…I want to display 3 rows of 3 dates for a total of 9 dates. I want to sort them by date.
Here’s the layout of the table…
autoid, procdate, paydate, deliverydate
Here’s my code so far:
[code=php]$eArray = array();
$dSQL = “SELECT * FROM procDates WHERE deliverydate > NOW() LIMIT 3”;
$dQRY = mysql_query($dSQL);
$dCnt = 1;
while ($dobj = mysql_fetch_object($dQRY)) {
//Org Orders Cutoff
$eArray[‘Org Orders Close’] = strtotime($dobj->procdate);
//Org Payments Due
$eArray[‘Org Payment Due’] = strtotime($dobj->paydate);
$dCnt++;
//DISTRIBUTION DAY!!
$eArray[‘Distribution Day’] = strtotime($dobj->deliverydate);
}
asort($eArray);
echo “<h2>Upcoming Events</h2>
<br />
<ul style=’list-style-type: none;’>”;
foreach($eArray as $key => $value) {
$date = date(“M j – g:ia”, $value);
echo “<li><font size=’2′><b>” . $date . “</b></font> ” . $key . “</li>”;
}
echo “</ul>”;
Only problem is that as the WHILE loop goes through the 3 rows…it over-writes the array items. How do I prevent that?
I only get 3 items listed in my unordered list….
Example: [url]http://www.southatlantafoodsource.com
Click Calendar. You should see 9 items there…starting in September….
I guess I could do something like:
[code=php]
$eArray[] = array(‘Org Orders Close’ => strtotime($dobj->procdate);
But how would I read that back in and sort through it?