Re: Is this a valid insert
| From: | Mike Hammonds | Date: | Fri, 08 Sep 2000 20:33:35 +0000 |
| Subject: | Re: Is this a valid insert | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-2750@lists.php.net to get a copy of this message | ||
** 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','$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
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
BEGIN:VCARD VERSION:2.1 X-GWTYPE:USER FN:Mike Hammonds TEL;WORK:x7389 ORG:;IS TEL;PREF;FAX:426-8800 EMAIL;WORK;PREF;NGW:Mike.Hammonds@knowledgeinenergy.com N:Hammonds;Mike TITLE:IS MAnager X-GWUSERID:mhammonds END:VCARD
BEGIN:VCARD VERSION:2.1 X-GWTYPE:USER FN:Mike Hammonds TEL;WORK:x7389 ORG:;IS TEL;PREF;FAX:426-8800 EMAIL;WORK;PREF;NGW:Mike.Hammonds@knowledgeinenergy.com N:Hammonds;Mike TITLE:IS MAnager X-GWUSERID:mhammonds END:VCARD