Re: Insert in database
| From: | Miguel Cruz | Date: | Mon, 29 Apr 2002 21:17:23 +0000 |
| Subject: | Re: Insert in database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95271@lists.php.net to get a copy of this message | ||
On Mon, 29 Apr 2002, Richard Baskett wrote:
> 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 !!!");
> }
>
> ?>
He needs a few more curly braces. The $query assignment should be
something like this:
$query="INSERT INTO PHPUsers(FName,LName) VALUES
({$_POST['fname']},{$_POST['lname']})";
miguel