I'm very new to PHP so I'm still learning how to do stuff. I cannot figure out what is wrong with this code:

if($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";}
			else{
				$time = round($row->played_time,2) " secs";
			}

The code works fine if I don't use round or include the secs, mins, hours or days but like that I get this error:

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

Line 37 is the second line ($time = round($row->played_time,2) / 60 " mins";}).

How can I do what I need it to do?

This should work for you.

if($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';}
			else{
				$time = round($row->played_time,2) .' secs';
			}

Thanks, that worked but it seems to not be moving the decimal to only 2 places.

For example, rather than reporting "30.38 mins", it reports "30.3833333333 mins". It seems to only not move the decimal to 2 places if the decimal is repeating.

print "The answer is ".sprintf("%4.2f",round($row->played_time,2) / 60);
echo "mins"

Give a try!