Re: Is this a valid insert
| From: | Doug Semig | Date: | Fri, 08 Sep 2000 21:01:30 +0000 |
| Subject: | Re: Is this a valid insert | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2753@lists.php.net to get a copy of this message | ||
First, you send one of the INSERT statements to the database via a call to
mysql_exec(), then you send the next INSERT statement to the database via
another call to mysql_exec().
Doug
At 04:33 PM 9/8/00 -0400, Mike Hammonds wrote:
>** Reply Requested When Convenient **
>
>ok my mistake but how do I update 2 tables at the same time?
>
>Mike Hammonds, CNE5, MCP-NT
>Fellon-McCord & Associates, Inc.
>Office: 502.426.4500 Ext. - 7389
>Fax: 502.426.8800
>mhammonds@knowledgeinenergy.com
>
>>>> Franklin Hays <frank@kyk.als.orst.edu> 09/08/00 04:29PM >>>
>
>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','$p
hoto')";
>
>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','$ph
oto')";
>> "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
>>
>>