Welcome to Dream.In.Code
Become a PHP Expert!

Join 136,939 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,852 people online right now. Registration is fast and FREE... Join Now!




combining sql queries

 
Reply to this topicStart new topic

combining sql queries

capty99
25 Mar, 2008 - 06:27 PM
Post #1

the real kya
Group Icon

Joined: 26 Apr, 2001
Posts: 9,172



Thanked: 16 times
Dream Kudos: 550
My Contributions
I never read the section on combining sql queries, so my code is real ugly.

right now i have a $query, which after inserting i grab the id from, and then insert another query using that id.

anyone got a link to something that shows how to combine a couple of them together instead of running everything seperately.
User is online!Profile CardPM
+Quote Post

spullen
RE: Combining Sql Queries
26 Mar, 2008 - 08:40 AM
Post #2

D.I.C Regular
Group Icon

Joined: 22 Mar, 2007
Posts: 330



Thanked: 1 times
Dream Kudos: 50
My Contributions
I think that is the correct way of doing it. I've never heard of any doing a double insert. But you should probably look at transactions (if you're using mySQL 5, not too sure about other SQL servers though). Transactions will rollback anything you did within the transaction if there is an error anywhere, which is good when you're doing multiple inserts into a db.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 10:51PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month