|
Posted by no on 06/21/05 03:14
Hi
I have a very simple script that has to either INSERT a record if one
doesn't exist or UPDATE one if it does (the table has a unique index
on 2 fields). So, i am using PEAR DB and i was hoping to do an INSERT,
then trap any resulting error and if it creates an error (assume it is
caused by a duplicate) and do the UPDATE.
My problem is, i always get an error ("DB Error: already exists"),
even if i preceed the $db->query() with @ ... or i switch
error_reporting(0). It never allows me to do my own error handling.
How should i be doing this? Am i on the right track? :-s
Many thanks
Chris R.
Navigation:
[Reply to this message]
|