Re: ON DUPLICATE KEY UPDATE
| From: | kesavan trichy rengarajan | Date: | Sun, 28 Nov 2010 02:16:49 +0000 |
| Subject: | Re: ON DUPLICATE KEY UPDATE | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-47510@lists.php.net to get a copy of this message | ||
Read through this:
http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html,
especially
the last 2 paragraphs.
On Sun, Nov 28, 2010 at 12:40 PM, Ron Piggott <
ron.piggott@actsministries.org> wrote:
> My question is with the syntax below: If the “ON DUPLICATE KEY UPDATE
>
name = '$name'” occurs will
> $_SESSION['referral_clients_reference'] be
> populated with the mysql_insert_id() value? If not, should I just query for
> it? Ron
>
> mysql_query("INSERT INTO referral_clients (
> reference , name ,
> paypal_email , last_update )
> VALUES ( NULL , '$name', '$paypal_email',
> CURRENT_TIMESTAMP ) ON DUPLICATE KEY UPDATE name =
> '$name';");
>
> $_SESSION['referral_clients_reference'] = mysql_insert_id();
>
> The Verse of the Day
> “Encouragement from God’s Word”
> http://www.TheVerseOfTheDay.info