Well you don't have an curly braces anywhere in your code.. Try this:
<?php If (($_POST['fname']=="") || ($_POST['lname']=="") { echo("Please Enter Information In All The Fields !!!"); } Else { $connectionString=odbc_connect("PHPInsert","sa",""); $query="INSERT INTO PHPUsers(FName,LName) VALUES ($_POST['fname'],$_POST['lname'])"; $exeQuery=odbc_do($connectionString,$query); odbc_close($connectionString); echo("Hi ",$_POST['fname']," ",$_POST['lname'],"Thank You For Registering !!!"); } ?> Rick "It is the mark of an educated mind to be able to entertain a thought without accepting it." - Aristotle > From: "Arpan De" <[EMAIL PROTECTED]> > Date: Tue, 30 Apr 2002 02:34:53 +0530 > To: [EMAIL PROTECTED] > Subject: [PHP] Insert in database > > I have a simple HTML Form where a user has to enter his first & last name > which will be inserted in a SQL Server database table. The PHP code which > does the needful is as follows (I have created a DSN named PHPInsert > successfully as well): > > <?php > If(($_POST['fname']=="") || ($_POST['lname']=="") > echo("Please Enter Information In All The Fields !!!"); > Else > $connectionString=odbc_connect("PHPInsert","sa",""); > $query="INSERT INTO PHPUsers(FName,LName) VALUES > ($_POST['fname'],$_POST['lname'])"; > $exeQuery=odbc_do($connectionString,$query); > odbc_close($connectionString); > > echo("Hi ",$_POST['fname']," ",$_POST['lname'],"Thank You For > Registering !!!"); > ?> > > The above code, when executed, throws the following error: > > Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting > T_STRING or T_VARIABLE or T_NUM_STRING > > pointing to the line where the variable $query is assigned the SQL > statement. What does the above error mean? Both the fields in the database > are varchar datatype. The table also has an ID field which is an IDENTITY > field auto-incrementing by 1. Where am I going wrong? > > Thanks, > > Arpan > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php