Re: Is this a valid insert
| From: | Franklin Hays | Date: | Fri, 08 Sep 2000 20:29:32 +0000 |
| Subject: | Re: Is this a valid insert | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2749@lists.php.net to get a copy of this message | ||
AFAIK, believe the correct syntax is to specify the column name first,
then VALUES...
such as:
$query = "INSERT INTO person
(firstname,lastname,middlename,birthday,sign,email,photo)
VALUES('$firstname','$lastname','$middlename','$birthday',NULL,'$email','$photo')";
where the first set is the field names.
HTH,
/frank
On Fri, 8 Sep 2000, Mike Hammonds wrote:
> Date: Fri, 08 Sep 2000 16:19:17 -0400
> From: Mike Hammonds <mhammonds@knowledgeinenergy.com>
> To: php-db@lists.php.net
> Subject: [PHP-DB] Is this a valid insert
>
> ** Reply Requested When Convenient **
>
> I am trying to update two tables at the same time that are in the same database is this the
> right way to do this?
>
> $query = "INSERT INTO person
>
> VALUES('$firstname','$lastname','$middlename','$birthday',NULL,'$email','$photo')";
> "INSERT INTO company
>
> VALUES('$name','$city','$state','$zip','$address','$phone','$url')";
>
> $result = MYSQL_QUERY($query);
>
>
> Mike Hammonds, CNE5, MCP-NT
> Fellon-McCord & Associates, Inc.
> Office: 502.426.4500 Ext. - 7389
> Fax: 502.426.8800
> mhammonds@knowledgeinenergy.com
>
>