Re: [PHP-DB] Getting data on last INSERTed row
On Tuesday 24 June 2003 19:37, Daniel wrote: I'm wondering if there's an easy and non-system-demanding way to get data on an INSERTed row in PHP/MySQL? Specifically, I want the value of an auto-incremented primary key cell, uid. I'm INSERTing a new person into a table, and need to return this value to a Javascript function that maintains an array of all persons in this table. I want to avoid a full SELECT query that would rebuild the array from scratch and put unnessecary load on the SQL server. I first thought of mysql_affected_rows, but as far as I can read, it only returns the value of rows affected, i.e. 1 on any INSERT statement executed? Any ideas? Yeah, did it ever cross your mind to read the manual? mysql_insert_id() -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Getting data on last INSERTed row
Well, to tell you the truth, I thought I did. I may be a newbie and perhaps a little daft, so please excuse me if I ask stupid questions. Apart from that, thank you for your help. Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tuesday 24 June 2003 19:37, Daniel wrote: I'm wondering if there's an easy and non-system-demanding way to get data on an INSERTed row in PHP/MySQL? Specifically, I want the value of an auto-incremented primary key cell, uid. I'm INSERTing a new person into a table, and need to return this value to a Javascript function that maintains an array of all persons in this table. I want to avoid a full SELECT query that would rebuild the array from scratch and put unnessecary load on the SQL server. I first thought of mysql_affected_rows, but as far as I can read, it only returns the value of rows affected, i.e. 1 on any INSERT statement executed? Any ideas? Yeah, did it ever cross your mind to read the manual? mysql_insert_id() -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Getting data on last INSERTed row
Daniel, good luck in your endeavor, next time, just filter those with attitudes out. Many people on this list are very helpful. A few are not. I had a complete lose the attitude speech written out, but I think I'll just let you figure it out. Thanks for making this the great list it is Jason! removes self ___ Ryan Marrs Web Developer Sandler Travis Trade Advisory Services, Inc. 248.474.7200 x 183 248.474.8500 (fax) www.strtrade.com -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 24, 2003 7:43 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Getting data on last INSERTed row On Tuesday 24 June 2003 19:37, Daniel wrote: I'm wondering if there's an easy and non-system-demanding way to get data on an INSERTed row in PHP/MySQL? Specifically, I want the value of an auto-incremented primary key cell, uid. I'm INSERTing a new person into a table, and need to return this value to a Javascript function that maintains an array of all persons in this table. I want to avoid a full SELECT query that would rebuild the array from scratch and put unnessecary load on the SQL server. I first thought of mysql_affected_rows, but as far as I can read, it only returns the value of rows affected, i.e. 1 on any INSERT statement executed? Any ideas? Yeah, did it ever cross your mind to read the manual? mysql_insert_id() -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Getting data on last INSERTed row
Thank you, Ryan =) Ryan Marrs [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Daniel, good luck in your endeavor, next time, just filter those with attitudes out. Many people on this list are very helpful. A few are not. I had a complete lose the attitude speech written out, but I think I'll just let you figure it out. Thanks for making this the great list it is Jason! removes self ___ Ryan Marrs Web Developer Sandler Travis Trade Advisory Services, Inc. 248.474.7200 x 183 248.474.8500 (fax) www.strtrade.com -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 24, 2003 7:43 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Getting data on last INSERTed row On Tuesday 24 June 2003 19:37, Daniel wrote: I'm wondering if there's an easy and non-system-demanding way to get data on an INSERTed row in PHP/MySQL? Specifically, I want the value of an auto-incremented primary key cell, uid. I'm INSERTing a new person into a table, and need to return this value to a Javascript function that maintains an array of all persons in this table. I want to avoid a full SELECT query that would rebuild the array from scratch and put unnessecary load on the SQL server. I first thought of mysql_affected_rows, but as far as I can read, it only returns the value of rows affected, i.e. 1 on any INSERT statement executed? Any ideas? Yeah, did it ever cross your mind to read the manual? mysql_insert_id() -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php