Is there a way to use transactios in MySQL??

Of course. They only work properly with innodb tables though. This is all in the mysql documentation (

Or maybe using a global variable accesed by all the processes running in the 

You could create a global 'sequence' table and use that to get the id's.

create table my_sequence(id int auto_increment);

when you need a new number,

$query = "update my_sequence set id=last_insert_id(id+1)";
$result = mysql_query($query);
$new_id = mysql_insert_id();

Or actually creating the auto_increment fields by inserting as many rows 
needed, but what if the user cancels the operatuion?

What difference does that make? You'll have id's in the sequence but not used anywhere. No big deal.

PS: Can you get rid of all that other crap when you send to a mailing list? Sign up for a gmail or hotmail account or something (if you need an invite let me know).

Postgresql & php tutorials

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to