Hey list, i'm new to php so bare with me...

got some questions on mysql commands. I'd like to know how the 
mysql_insert_id() function works exactly. 
First of all how reliable is it? What happens this happens:
Table: (ID int unsigned primary key auto_increment, Stuff text, MoreStuff 
(my script)
insert into table values(NULL, "bla", "bla")
(some other application)
insert into table values(NULL, "bleh", "bleh")
(my script)
$id = mysql_insert_id

it's not likely that this will happen, but if the site is very/extremely 
crowded it could be that there's an insert right after mine but before me 
callind mysql_insert_id. As you might guess I'd like to know which ID will be 
returned, the one my script created or the one from the other application?

Also what happens if my table is like this:
Table: (Stuff text, ID int unsigned primary key auto_increment, OtherStuff 
Thus having the ID on column 2 instead of 1
or like this
Table: (Bla int unsigned primary key auto_increment, Stuff text, Otherstuff 
Thus the ID not having the name ID
Or like this
Table: (bla int unsigned primary key auto_increment, id int unsigned primary 
key auto_increment, stuff text, otherstuff text)
Thus having 2 auto_increment columns where the 2nd one is called ID (lower 

I'm really uncertain about that and couldn't find it back in the manual.... 
does it only read the first column? does this column have to be named ID, 
what if ID is another column? what if there is more than 1 auto_increment 
column in the table? what happens if some(one)/(thing) else inserts before 
calling mysql_insert_id.

One more question (pure curiosity this one) the return value from 
mysql_query... is that ever gonna be higher than 1? I assume it can be if the 
insert affects more than 1 line right? Also my book says that the return 
value is TRUE or FALSE for every command except for an INSERT in which case 
it would be 0 on failure and higher on succes. I think that's crap? I'm 
guessing it will also return a number for UPDATE's and REPLACE's is that 
correct? Are there others?

OK just one more thing, this is for the people from troutworks if they're 
monitoring this list. I think the translation of the PHP Bible is 
crap!!!!!!!!! Please complain about it at the translator. The guy/girl 
managed to translate (quotes) " to (comma's) , and there are a lot of other 
wrongly translated things in there, luckily the examples in there got me on 
the right path again over and over showing that the translation was incorrect 
but it's just confusing like hell. The number of mistakes is unbelievable 
(and i'm NOT talking about spelling errors, I'm talking about messy stuff 
like calling quotes comma's) and I'm 100% certain it was NOT translated by a 


PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to