speters, Thursday, September 19, 2002, 10:55:41 PM, you wrote: samdc> If i use a replace query, and there isn't an error, then either samdc> a new row was inserted, or an existing row was updated.
samdc> The primary key in the table i'm replacing to is defined as samdc> mprid int not null auto_increment primary key samdc> whether an insert or update actually occurs, i want to get the value of samdc> mprid that was affected. samdc> if it's a new row, i assume i can use select last_insert_id() samdc> but if its an update, will that work? LAST_INSERT_ID() will return you correct value only if you insert NULL or 0 into auto_increment field: http://www.mysql.com/doc/en/Miscellaneous_functions.html If you insert NULL or 0 why do you use REPLACE? If you insert any other values, you should know what you inserted, shouldn't you? -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Victoria Reznichenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php