looping data from MySQL to create an array then display it
| From: | Matt Babineau | Date: | Fri, 07 Jun 2002 13:20:06 +0000 |
| Subject: | looping data from MySQL to create an array then display it | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-14124@lists.php.net to get a copy of this message | ||
<?
echo "Rows: " . $result2_rows . "<BR>";
for ($i=0; $i < $result2_rows; $i++ ) {
$rows2 = mysql_fetch_array($result2);
$dailyCount[date("d-m-Y", $rows2["DateTime"])] = $rows2["Count"];
}
for ($i = 0; $i < count($dailyCount); $i++) {
echo $dailyCount[$i] . "<BR>";
}
?>
I am trying to create an array with a "d-m-Y" Key, and a number for the
Value based from the date in the database. I suspect that the array
creation is the part that isn't working but I'm not sure how to get the
array to set the $key=>$value how I want it.
Matt Babineau
Freelance Internet Developer
-----------------------------------------
e: <mailto:matt@criticalcode.com>
matt@criticalcode.com
p: 603.943.4237
w: <http://www.criticalcode.com/> http://www.criticalcode.com
PO BOX 601
Manchester, NH 03105