Page 1 of 1

[SOLVED] help with parse error, unexpected t_variable

Posted: Mon Aug 23, 2004 10:56 am
by Jonny1213
I can't figure out why this isn't working. Syntax seems OK to me, need an experts opinion. Thanks!

Code: Select all

<?php

$sql = "INSERT INTO users SET
              username = '$_POST[username]',
              password = '$_POST[password]',
              firstname = '$_POST[firstname]',
              lastname = '$_POST[lastname]',
              department = '$_POST[department]',
              email = '$_POST[email]'";

?>
This is where the error is. If more code is needed to decipher, let me know.

Posted: Mon Aug 23, 2004 11:04 am
by feyd
check the previous line..

what's the error message?

Posted: Mon Aug 23, 2004 11:14 am
by Jonny1213
the error is a parse error, unexpected t_variable

the line before it is as follows

Code: Select all

<?php

dbConnect('members');

    if ($_POST['username']=='' or $_POST['firstname']=='' or $_POST['lastname']==''
      or $_POST['department']=='' or $_POST['email']=='') {
        error('One or more required fields were left blank.\\n'.
              'Please fill them in and try again.');
    }
?>
This part of the code seems to work...it's driving me crazy!

Thanks for helping!
?>

Posted: Mon Aug 23, 2004 11:31 am
by feyd
hmm I'm not seeing anything..

could you post a bunch of the code, both those preceeding, the problem area, and those following it?

Posted: Mon Aug 23, 2004 6:23 pm
by Jonny1213
i re-wrote all of the code and it works now...must've been something really dumb on my part! thanks for your help feyd