I would like to be able to make an entire transaction of 3 or more queries on the same page. I am coding in PHP 5 for a mysql 4.1 database.
for instance, I have a username table and a userspassword table:
[COLOR=red]username userspassword
+---------------+ +---------------+
| uid | username | | uid | password |
+---------------+ +---------------+[/COLOR]
I'd like to do an INSERT into the username table (uid auto-increments), SELECT query the username's uid,
then INSERT the uid and password on the userpassword table.
Lets say that the first insert is executed and then my server crashes somehow. When I reboot, I don't want just a username without a password in the database. Is there any way to ensure that either all three queries are executed or nothing is inserted into the database?
I just read up on "STORED PROCEDURES" in MySQL 5. It's not supported in MySQL 4.1. Is there something for 4.1 that will ensure that I don't have any screw ups on my server?
Thanks in advance,
Wiz