Re: date functions (generates parse error)
| From: | 1LT John W. Holmes | Date: | Tue, 04 Mar 2003 19:07:58 +0000 |
| Subject: | Re: date functions (generates parse error) | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26094@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;
>
> }
I cut and pasted your exact code here and didn't get a parse error.
---John Holmes...