[SOLVED] help with parse error, unexpected t_variable

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jonny1213
Forum Newbie
Posts: 3
Joined: Mon Aug 23, 2004 10:56 am

[SOLVED] help with parse error, unexpected t_variable

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

check the previous line..

what's the error message?
Jonny1213
Forum Newbie
Posts: 3
Joined: Mon Aug 23, 2004 10:56 am

Post 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!
?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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?
Jonny1213
Forum Newbie
Posts: 3
Joined: Mon Aug 23, 2004 10:56 am

Post 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
Post Reply