Re: [PHP] Retrieve value of newly inserted row.

2007-02-15 Thread Dan Shirah
Okay, I found the correct function and below is what I have: - Show quoted text - $insert1 = INSERT INTO table1 ( debit_card, card_type, card_number, exp_date, payment_amount, cvv_number, first_name, middle_name, last_name, address_1,

RE: [PHP] Retrieve value of newly inserted row.

2007-02-15 Thread Brad Fuller
Okay, I found the correct function and below is what I have: - Show quoted text - $insert1 = INSERT INTO table1 ( snip ) VALUES ( snip ) SELECT scope_identity() INSERT INTO table2 ( credit_card_id, case_number, comments) VALUES (

Re: [PHP] Retrieve value of newly inserted row.

2007-02-15 Thread Dan Shirah
I GOT IT! WooHoo! Thanks to a co-worker, this problem has been solved! I was using scope_identity incorrectly. This is how you should use it: INSERT INTO Table1 ( Column1, Column2) VALUES ( Value1, Value2) INSERT INTO Table2 ( Column1, Column2) VALUES (

Re: [PHP] Retrieve value of newly inserted row.

2007-02-14 Thread Robert Cummings
On Wed, 2007-02-14 at 13:20 -0500, Dan Shirah wrote: Hello, On my second insert statement, please note credit_card_id. This is an auto_increment column in table1. What I need to do is pull the value of credit_card_id from the newly inserted row from insert1 and put that value in a

Re: [PHP] Retrieve value of newly inserted row.

2007-02-14 Thread Arpad Ray
Dan Shirah wrote: On my second insert statement, please note credit_card_id. This is an auto_increment column in table1. What I need to do is pull the value of credit_card_id from the newly inserted row from insert1 and put that value in a variable to assign it to credit_card_id in insert2.

RE: [PHP] Retrieve value of newly inserted row.

2007-02-14 Thread Tim
-Message d'origine- De : Dan Shirah [mailto:[EMAIL PROTECTED] Envoyé : mercredi 14 février 2007 19:20 À : php-general Objet : [PHP] Retrieve value of newly inserted row. Hello, I have a page the contains two insert statements. $insert1 = INSERT INTO table1 (

Re: [PHP] Retrieve value of newly inserted row.

2007-02-14 Thread Robert Cummings
On Wed, 2007-02-14 at 13:26 -0500, Robert Cummings wrote: On Wed, 2007-02-14 at 13:20 -0500, Dan Shirah wrote: Hello, On my second insert statement, please note credit_card_id. This is an auto_increment column in table1. What I need to do is pull the value of credit_card_id from the

RE: [PHP] Retrieve value of newly inserted row.

2007-02-14 Thread Tim
-Message d'origine- De : Tim [mailto:[EMAIL PROTECTED] Envoyé : mercredi 14 février 2007 19:28 À : 'Dan Shirah'; 'php-general' Objet : RE: [PHP] Retrieve value of newly inserted row. -Message d'origine- De : Dan Shirah [mailto:[EMAIL PROTECTED] Envoyé : mercredi

RE: [PHP] Retrieve value of newly inserted row.

2007-02-14 Thread Robert Cummings
On Wed, 2007-02-14 at 19:34 +0100, Tim wrote: -Message d'origine- De : Tim [mailto:[EMAIL PROTECTED] I hope that wasn't too confusing. http://cz2.php.net/manual/en/function.mysql-insert-id.php Sorry my eyes played some tricks on me ragarding mysql/mssql refer to

Re: [PHP] Retrieve value of newly inserted row.

2007-02-14 Thread Dan Shirah
Sorry, I wasn't trying to fool you, I promise! :) Arpad, From looking on the web (MSDN) I found the @@identity and the explanation of what it is, but MS's example is horrible and does not show a good context for using this function. Could you elaborate more on its use? On 2/14/07, Robert

RE: [PHP] Retrieve value of newly inserted row.

2007-02-14 Thread Brad Fuller
From looking on the web (MSDN) I found the @@identity and the explanation of what it is, but MS's example is horrible and does not show a good context for using this function. Could you elaborate more on its use? $q = mssql_query(INSERT INTO TableName(...) VALUES(...) SELECT

Re: [PHP] Retrieve value of newly inserted row.

2007-02-14 Thread Jim Lucas
Brad Fuller wrote: From looking on the web (MSDN) I found the @@identity and the explanation of what it is, but MS's example is horrible and does not show a good context for using this function. Could you elaborate more on its use? $q = mssql_query(INSERT INTO TableName(...) VALUES(...)