Re: date functions (generates parse error)
| From: | David Rice | Date: | Wed, 05 Mar 2003 17:33:57 +0000 |
| Subject: | Re: date functions (generates parse error) | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-26105@lists.php.net to get a copy of this message | ||
Sorry, I forgot to add the part at the bottom where I am calling the function
=================================================================
<?
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;
}
function dbconnect(){
mysql_connect("localhost", "filterseveuk", "godisadj");
mysql_select_db("filterseveuk");
}
dbconnect();
$date = "2003-03-02";
var_dump(tips($date));
?>
_________________________________________________________________
Express yourself with cool emoticons http://messenger.msn.co.uk