Here... look at this:

LOCK TABLES `presa_im` WRITE, `presa_im_titlu` WRITE, `presa_im_continut`
WRITE;
INSERT INTO `presa_im` (`nr`, `pag`, `ordine`) VALUES (5, 1,
CEILING(RAND()*1000));
SELECT @ID:=LAST_INSERT_ID();
INSERT INTO `presa_im_title` VALUES(@ID, 'TITLE in Romanian', 'TITLE in
English', 'TITLE in French');
INSERT INTO `presa_im_content` VALUES(@ID, 'Content in Romanian', 'Content
in English', 'Content in Fench');
UNLOCK TABLES;

This way you do not need to actualy capture the value of the last insert id
from MySQL in your application...

Gabriel PREDA
www.amr.ro
www.lgassociations.info

----- Original Message ----- 
From: "James Black" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Saturday, March 26, 2005 12:14 AM
Subject: re: using one query to save data in 4 tables


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I am curious if this would be possible, and which version of mysql would
> be needed.
>
> Basically,  I want to store a user in one table, then get the id for the
> user I just saved, and store three more rows, each in a different
> database, using the user's id in the insert statements.
>
> Thanx.
>
> - --
> "Love is mutual self-giving that ends in self-recovery." Fulton Sheen
> James Black    [EMAIL PROTECTED]
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (MingW32)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFCRH8iikQgpVn8xrARAsw5AJ0SxPoMMcy1QUa1GNNEdfg51Q7Q8ACfYHg7
> NdFWteuQU4JjSfx7yYS++9k=
> =JZD5
> -----END PGP SIGNATURE-----
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to