Re: Question
| From: | Ignatius Reilly | Date: | Sat, 07 Feb 2004 19:44:05 +0000 |
| Subject: | Re: Question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-32837@lists.php.net to get a copy of this message | ||
Quotes:
$_POST['testField']
_________________________
----- Original Message -----
From: <Remember14a@aol.com>
To: <php-db@lists.php.net>
Sent: Saturday, February 07, 2004 20:36
Subject: [PHP-DB] Question
> Dear friends,
>
> On submitting form to mysql database I get a parse error,There is no
problem
> with connection code, Problem is some where around create the sql
statement
> Can any one figure out where is the precise error, please.
> Following is the code from php file
>
> <?php
> // open the connection
> $conn = mysql_connect("localhost", "", "");
>
> // pick the database to use
> mysql_select_db("testDB",$conn);
>
> // create the SQL statement
> $sql = "INSERT INTO testtable values ('{$_POST[testField]}','
>
> {$_POST[testFielda]}','{$_POST[testFieldb]}','{$_POST[testFieldd]}','
> {$_POST[testFieldc]}','{$_POST[testFielde]}')";
>
>
>
> // execute the SQL statement
> if (mysql_query($sql, $conn)) {
> echo "record added!";
> } else {
> echo "something went wrong";
> }
> ?>
> --------------------------------------------------------------------------
---
> Asif
>