hi,

i use MySQL, and have a table where each user is allocated a number (x) which is different for each user. To find a value of X for a new user (g), the function (MAX(users.x)+1) is used to find the new x for a new user, and an insert statement, "insert (username (g), x) into users" (near enough ;P) is used to add a user and his value of x to the table. These queries are both done by a php script one after another. how can i be sure that they are done one after the other by the database, by that i mean, how do i know that someone hasnt inserted a new record in between the max(users.x)+1 has been found, and inserting the user (g) for which max(users.x)+1 has been found, thus making this value wrong (as someone will have already selected that value) (since finding max(users.x)+1 again will weild a different answer). Using an auto_increment is not an option.

cheers
gimboid