PHP School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a PHP Expert!

Join 300,354 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,923 people online right now. Registration is fast and FREE... Join Now!




syntax error, unexpected T_VARIABLE....

 

syntax error, unexpected T_VARIABLE....

Decypher

2 Jul, 2009 - 05:03 AM
Post #1

D.I.C Regular
***

Joined: 28 Jun, 2008
Posts: 370



Thanked: 2 times
My Contributions
CODE
        $time = rand(30,90);
        
        $jailtime="INSERT INTO jail (username, time, length) VALUES ('".$username."', NOW(), '"$time"')";
        $jailresult = mysql_query($jailtime);


error:
Parse error: syntax error, unexpected T_VARIABLE in /home/a6490674/public_html/Mafia/crime.php on line 60

I know it means usually a semi-colon is missin but I can't see one missin here...any ideas?

EDIT: Title edited to be more descriptive

PsychoCoder smile.gif

User is offlineProfile CardPM
+Quote Post


Decypher

RE: Syntax Error, Unexpected T_VARIABLE....

2 Jul, 2009 - 05:34 AM
Post #2

D.I.C Regular
***

Joined: 28 Jun, 2008
Posts: 370



Thanked: 2 times
My Contributions
[edit] resolved the problem
User is offlineProfile CardPM
+Quote Post

dimjaxor

RE: Syntax Error, Unexpected T_VARIABLE....

2 Jul, 2009 - 05:35 AM
Post #3

New D.I.C Head
*

Joined: 10 Sep, 2008
Posts: 40


My Contributions
QUOTE(Decypher @ 2 Jul, 2009 - 05:03 AM) *

CODE
        $time = rand(30,90);
        
        $jailtime="INSERT INTO jail (username, time, length) VALUES ('".$username."', NOW(), '"$time"')";
        $jailresult = mysql_query($jailtime);


error:
Parse error: syntax error, unexpected T_VARIABLE in /home/a6490674/public_html/Mafia/crime.php on line 60

I know it means usually a semi-colon is missin but I can't see one missin here...any ideas?


unexpected T_VARIABLE could mean a few things, missing ; or you didn't close brackets, but I am going to go with you left out the periods for the $time variable

CODE
        $time = rand(30,90);
        
        $jailtime="INSERT INTO jail (username, time, length) VALUES ('".$username."', NOW(), '"$time"')";  //RIGHT HERE -- >   '".$time."'
        $jailresult = mysql_query($jailtime);

User is offlineProfile CardPM
+Quote Post

Decypher

RE: Syntax Error, Unexpected T_VARIABLE....

2 Jul, 2009 - 07:54 AM
Post #4

D.I.C Regular
***

Joined: 28 Jun, 2008
Posts: 370



Thanked: 2 times
My Contributions
nah it was the fact I forgot to add the $ sign on the username part when I first dragged from the database... thanks anyways...



This post has been edited by Decypher: 2 Jul, 2009 - 08:10 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 07:16PM

Live PHP Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month