Re: Is this a valid insert

From: Date: Sat, 09 Sep 2000 05:28:06 +0000
Subject: Re: Is this a valid insert
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-2762@lists.php.net to get a copy of this message
Oops...sorry...I mixed pg_exec() with mysql_query() to form a new and non-existent PHP function! Of course, it's mysql_query(). I've been doing so much development with PostgreSQL lately that the _exec was the natural thing for my fingers to type. Lesson: don't try to do more than five things at a time! Nevertheless, the gist is that you simply send two INSERTs to the backend. Doug At 05:08 PM 9/8/00 -0400, Mike Hammonds wrote: >** Reply Requested When Convenient ** > >Iv never used mysql_exec(), can you give me an example? > >Mike Hammonds, CNE5, MCP-NT >Fellon-McCord & Associates, Inc. >Office: 502.426.4500 Ext. - 7389 >Fax: 502.426.8800 >mhammonds@knowledgeinenergy.com > >>>> Doug Semig <dougslist@semig.com> 09/08/00 05:01PM >>> >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 >>> >>> > > > >-- >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 > > > >Attachment Converted: "c:\program files\eudora\newdougslists\attach\Mike Hammonds1.vcf" >

« previous php.db (#2762) next »