PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old July 24th, 2002, 06:46 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
Inserting into two tables at one click

Hello

I want to insert some data into 2 of my tables through my PHP form.How can i do it?

For example, field1, field2 should be inserted into table 1 and field3, field4 should be inserted into table 2.

I'm able to insert into one table but not into 2 tables simultaneously.

Any help??

Thank you

Reply With Quote
  #2  
Old July 24th, 2002, 06:48 PM
DeVeRaS DeVeRaS is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Portugal
Posts: 31 DeVeRaS User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to DeVeRaS
RE: Inserting into two tables at one click

The easy way is to have 2 querys...
be well

Reply With Quote
  #3  
Old July 24th, 2002, 07:06 PM
CmdrDats CmdrDats is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: <br><img src='http://www.dats.co.za/icon.gif'>
Posts: 269 CmdrDats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to CmdrDats Send a message via AIM to CmdrDats Send a message via Yahoo to CmdrDats
RE: Inserting into two tables at one click

hehe, yeah, why do you need to insert into 2 tables simultaneously anyhow?

Reply With Quote
  #4  
Old July 24th, 2002, 07:15 PM
DeVeRaS DeVeRaS is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Portugal
Posts: 31 DeVeRaS User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to DeVeRaS
RE: Inserting into two tables at one click

Yes, maybe your table has not a good structure ?
Let us help..

Reply With Quote
  #5  
Old July 24th, 2002, 08:09 PM
ASk ASk is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 12 ASk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Inserting into two tables at one click

try "INSERT into table1, table2 VALUES(table1.field1='', table1.field2='', table2.field3='', table2.field4='')"

never tested it with multiple tables, but should work IMO

Reply With Quote
  #6  
Old July 24th, 2002, 08:13 PM
CmdrDats CmdrDats is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: <br><img src='http://www.dats.co.za/icon.gif'>
Posts: 269 CmdrDats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to CmdrDats Send a message via AIM to CmdrDats Send a message via Yahoo to CmdrDats
RE: Inserting into two tables at one click

Doesn't work, i tried it with INSERT INTO users, notes (notes.id, users.id) VALUES (1000, 1000) and it had a problem from the , notes part if i remember correctly..

Reply With Quote
  #7  
Old July 25th, 2002, 03:04 AM
siteworkspro.com siteworkspro.com is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Sydney, Australia
Posts: 92 siteworkspro.com User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to siteworkspro.com Send a message via AIM to siteworkspro.com
RE: Inserting into two tables at one click

try this

mysql_query("INSERT into table1 VALUES(field1='', field2=''");

mysql_query("INSERT into table2 VALUES( table2.field3='', table2.field4=''");

that will work


Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Inserting into two tables at one click


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway