Re: date functions (generates parse error)
| From: | David Rice | Date: | Tue, 04 Mar 2003 18:54:57 +0000 |
| Subject: | Re: date functions (generates parse error) | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-26093@lists.php.net to get a copy of this message | ||
Here is the whole code of my function
Whenever i run it, it say's there is a parse error on line 6, can't see what is the problem
the format of $weekstart (as it is stored in the Database) is YYYY-MM-DD
=================================================================
<?
function tips($weekstart){
$start = date('Ymd',strtotime($weekstart));
$query = "SELECT * FROM Rota WHERE date >= $start and date <= ($start + INTERVAL 6 DAY) ORDER BY staffid";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)){
if ( isset ( $tips ) ){
if (isset ( $tips[$row[staffid]] ) ){
$hours = $row[finish] - $row[start];
$tips[$row[staffid]] = $tips[$row[staffid]] + $hours;
}
else{
$tips[$row[staffid]] = $row[finish] - $row[start];
}
}
else{
$tips = array('$row[staffid]' =>( $row[finish] - $row[start] ) );
}
}
return $tips;
}
_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger http://messenger.msn.co.uk