FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » try / catch or INSERT INTO... ON DUPLICATE KEY UPDATE
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
try / catch or INSERT INTO... ON DUPLICATE KEY UPDATE [message #175294] Thu, 01 September 2011 03:50 Go to previous message
jwcarlton is currently offline  jwcarlton
Messages: 76
Registered: December 2010
Karma:
Member
I promise that this is a PHP question, and not MySQL!

I'm currently sending a query of INSERT INTO... ON DUPLICATE KEY
UPDATE. But, I'd like to know which one happened in my PHP; was it
new, or was it updated?

Is there a way to find this? Or should I do something like:

try {
$query = sprintf("INSERT...");
$sth = mysql_query($query) or die(mysql_error());

$duplicate = false;
}

catch (Exception $e) {
$query = sprintf("UPDATE...");
$sth = mysql_query($query) or die(mysql_error());

$duplicate = true;
}
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: does paypal standard method supports for recurring payment.
Next Topic: php help
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 09:39:23 GMT 2024

Total time taken to generate the page: 0.05047 seconds