RE: MySQL, Multiple tables, and Multipage form using sessions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If you are usiing the INNOdb table type/engine in the mysql db, it supports transactions. you can wrap the entire set of sql statement in a transaction and they would get executed as one block. If any fail, then the whole thing is rolled back. This DOES NOT work with the myISAM table types.

$sql = "begin ";
$sql .="insert into table 1...";
$sql .="insert into table 2...";
$sql .="insert into table N...";
$sql .="end";

$result = mysql_query($sql);

hth


From: Stuart Felenstein <stuart4m@xxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject:  MySQL, Multiple tables, and Multipage form using sessions
Date: Wed, 13 Oct 2004 13:41:46 -0700 (PDT)

Can anyone, someone please point me in the right
direction.
I have a multi page form, so at the last page I want
to insert all data into database. Basically I'm trying
to go from 0 - 90 , meaning my skills are less the
basic. And this seems like a big task.

Couple of other things.
1-There would need to be rollback.  One insert fails,
they all get rolled back.
2-The first table that get inserted has a "recordID",
from an auto inc int  field. That recordID has to be
put into all of the other child tables.
3-There are two multi select boxes.  The challenge
with them is they need to be looped in the insert to
their respecitive tables.

i.e.

Choice of colors - 5 (multi select)

+----------+----------+
| RecordID | Color    |
+----------+----------+
|  295         Blue   |
|  295         Red    |
|  295         Green  |
|  295         Oragne |
-----------------------

Are there any tutorials , good books that go into this
type of depth ? Is it really simple and Im just scared
? :)

I'm open to listening ,
Thank you ,
Stuart

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux