Fwd: Re: [PHP-DB] need help with foreach()
| From: | David Rice | Date: | Mon, 10 Mar 2003 09:56:56 +0000 |
| Subject: | Fwd: Re: [PHP-DB] need help with foreach() | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-26226@lists.php.net to get a copy of this message | ||
Here is the complete function I am using.
I returned, for testing i commented out the foreach loop and returned $staff, then $tips.... both arrays returned NULL when i did a var_dump(pointvalue($startdate));
can anyone see how this could be solved?
Cheers,
dave
==================================================
function pointvalue($start){
$query = "SELECT * FROM Tips WHERE date >= $start and date <= ($start + INTERVAL 6 DAY) ";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
$date = $row[Date];
$tips[$date] = $row[TotalTips];
}
$query = "SELECT * FROM Rota WHERE date >= $start and date <= ($start + INTERVAL 6 DAY) ";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)){
$date = $row[Date];
if (isset($staff[$date])){
$staff[$date] = $staff[$date] + 1;
}
else{
$staff[$date] = 1;
}
}
return $staff;
}
_________________________________________________________________
Use MSN Messenger to send music and pics to your friends http://messenger.msn.co.uk