0

For the life of me I cannot figure out this error.

require_once 'mysql.php'; // connect to MYSQL
-> $query = "INSERT INTO table (name, age, email, mc, sm, fit, trax, hh, claimed, handled, status)
          VALUES ('".$name."', '".$age."', '".$email."', '".$mc."', '".$sm."', '".$fit."', '".$trax."', '".$howheard."', '".$claimed."', '".$handled."', '".$status."')"; mysql_query($query) or die ('databse couldnt be updated'); echo "<br/><br/>Database updated with the information for MCID " .$mc. "<br/><br/>";

error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\xampp\htdocs\NAMEME.php on line 80 (Where the "->" is.)

Now, all this code was working fine, until I made a change to the mysql table I am using. I added a column named "id" and made it auto-increment. Here is the table structure:

CREATE TABLE whitelist (
     id MEDIUMINT NOT NULL AUTO_INCREMENT,
     name CHAR(30) NOT NULL,
     age INT NOT NULL,
     email TEXT NOT NULL,
     minecraft TEXT NOT NULL,
     steam TEXT NOT NULL,
     fit INT NOT NULL,
     trax TEXT NOT NULL,
     howheard TEXT NOT NULL,
     claimed INT NOT NULL,
     handled INT NOT NULL,
     status INT NOT NULL,
     PRIMARY KEY (id) ) ENGINE=MyISAMpablocdb

I truly cannot figure out where there is text that it wants to be a , or ;. Any help is appreciated.

Thanks!

UPDATE: Silly me, thanks to the guy who suggested I look up higher. My error was that I forgot to complete an echo function. I had:

echo "Hello

a few lines above. Silly me. Thanks for the quick responses, everyone :)

7
  • 3
    Welcome to Stack Overflow! I get worried when I see PHP code not using PHP Prepared Statements to prevent SQL Injection vulnerabilities. I hope you are sanitizing your variables in code that hasn't been pasted here. If not, please consider re-writing the code to use PDO Prepared Statements rather than trying to sanitize your variables. Commented Jan 1, 2012 at 1:55
  • I can't find a problem with your code. All ok. Commented Jan 1, 2012 at 1:57
  • 1
    The error may be on a line further above line 80 -- that is just where the interpreter gave up. Look a few lines higher. Commented Jan 1, 2012 at 1:57
  • My variables are indeed sanitized. Commented Jan 1, 2012 at 2:06
  • Found the problem, edited question. Thanks! Commented Jan 1, 2012 at 2:08

1 Answer 1

-1

I think the problem is characters '->' near $query.. just remove it :D

Sign up to request clarification or add additional context in comments.

1 Comment

That was just an arrow the point that that is line 80 in the file itself :P Has been fixed though. Updated the question with what solved it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.