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

    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).
     
  2. andythepandy

    andythepandy

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

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