Error on line 30 - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21) +---- Thread: Error on line 30 (/showthread.php?tid=22048) Pages:
1
2
|
Error on line 30 - Fragma - 09-08-2011 I keep getting this error: "Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /register.php on line 30" The code on lines 29, 30 & 31 is this: PHP Code: $query = "INSERT INTO tablename (username, password, email, ip) Can anybody spot where the error is? It's been driving me mad all day. RE: Error on line 30 - BreShiE - 09-08-2011 Which one of those 3 lines in the 30th line? I think I may know what it is... RE: Error on line 30 - Fragma - 09-08-2011 I mentioned that they are lines 29, 30 & 31, meaning the 2nd line is the 30th RE: Error on line 30 - BreShiE - 09-08-2011 Oh I'm not sure actually, I just though about that one. Hmm, try putting line 29 & 30 on just one line? It's saying it's an unexpected T_VARIABLE, did you set the variables? RE: Error on line 30 - Fragma - 09-08-2011 Yes I've set the variables. I've done some research and found that most of the time that this occurs, there is usually some sort of space somewhere, or a semi-colon in the wrong place, etc... However I can't see anything wrong with my bit of code?? I'm new to PHP so I could be wrong however I have asked a PHP coder on One.com if he could see anything wrong and he couldn't. RE: Error on line 30 - BreShiE - 09-08-2011 Oh, then I'm not sure, I just took another look at it and can't find any spaces either so I'm not sure. I think Laugh knows PHP so it would be worth asking him. RE: Error on line 30 - Peter L - 09-08-2011 I haven't touched php in awhile but try removing the final ; in line 30. RE: Error on line 30 - AceInfinity - 09-08-2011 Try this: PHP Code: $query = "INSERT INTO tablename values ('$username', '$password', '$email', '$ip')"; In you're code it's not seeing a ; or an , at the end of the first line, which is where your error comes from RE: Error on line 30 - Kyle FYI - 09-19-2011 PHP Code: $query = "INSERT INTO tablename (username, password, email, ip); RE: Error on line 30 - AceInfinity - 09-19-2011 (09-19-2011, 02:37 AM)Kyle FYI Wrote: I'm pretty sure that would be invalid too because it's not the end of the syntax when he has double quotes on 2 lines. The proper way is to use it all in one line of syntax: Code: $query = "INSERT INTO tablename VALUES ('$username', '$password', '$email', '$ip')"; |