Hi Mark,
I guess the best way would be to use some php and sql and let the application do the checking. First run a query to acertain if the key is present, if yes then update the main record else insert a new record. bascially you just need to bring the SQL logic into the app logic.
Bastien
From: Mark Benson <markbenson@xxxxxxx> To: php-db@xxxxxxxxxxxxx Subject: MySQL version issue Date: Tue, 04 Jan 2005 14:43:48 +0000
As some of you will recall, I enquired on this list about versions of MySQL and PHP a while back regarding and issue wit using the 'ON DUPLICATE KEY UPDATE' command in MySQL INSERT queries. Having upgraded our in-house system to PHP5 and MySQL 4 the issue was no longer a problem.
However I have subsequently enquired with our out-of-house web host and they are still using PHP 4.1.2 and MySQL 3.25.58. As one of the purposes of asking them was to establish if I could easily upload from my database to the remote database, I now have a problem. I was planning to use a compare and update script that used 'ON DUPLICATE KEY UPDATE' command in MySQL INSERT queries to add or change items on the remote server. However I can't, as it's a MySQL4 feature and the database to which I am writing ain't using MySQL4!
Any ideas about how I can create a MySQL3 compliant substitute for the 'ON DUPLICATE KEY UPDATE' Query action?
-- Mark Benson
http://homepage.mac.com/markbenson
-- 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