SQL Query Error With PHP

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Darkicon

Thread Starter
Joined
Feb 12, 2008
Messages
265
Code:
			if($row->played_time < 60){
				$time = round($row->played_time,2) " secs";}
			elseif($row->played_time >= 60){
				$time = round($row->played_time,2) / 60 " mins";}
			elseif($row->played_time >= 3600){
				$time = round($row->played_time,2) / 60 / 60 " hours";}
			elseif($row->played_time >= 86400){
				$time = round($row->played_time,2) / 60 / 60 / 24 " days";
			}
That code keeps reporting this error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /usr/www/eggroup/forum/rank.php on line 37

I cannot figure out what I forgot or messed up. Line 37 is the secs line (The second line).
 
Joined
Jul 2, 2006
Messages
379
Hi,
The problem is when you define the $time variable:
Code:
$time = round($row->played_time,2) " secs";}
To join the rounded time to the " secs" you must use a fullstop:

Code:
$time = round($row->played_time,2)  . " secs";}
Andy
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top