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
--
PHP Database Mailing List (
http://www.php.net/)
To unsubscribe, visit:
http://www.php.net/unsub.php