1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

SQL Query Error With PHP

Discussion in 'Software Development' started by Darkicon, Apr 25, 2010.

Thread Status:
Not open for further replies.
  1. Darkicon

    Darkicon Thread Starter

    Feb 12, 2008
    			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).
  2. andythepandy


    Jul 2, 2006
    The problem is when you define the $time variable:
    $time = round($row->played_time,2) " secs";}
    To join the rounded time to the " secs" you must use a fullstop:

    $time = round($row->played_time,2)  . " secs";}
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 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/919213

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice