Re: date functions (generates parse error)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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...


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux