Is there an equivalent to INSERT IGNORE
in the wpdb
class? As I'm fetching and inserting a twitter feed and the field in which I store the tweet ID is keyed UNIQUE
, I am aware that duplicates are going to occur and do not need Wordpress informing me of them in my PHP error log. (Note, I would write the query I need and $wpdb->prepare
it, but for whatever reason, that throws a bunch of other errors [that I'd be happy to share though don't consider them relevant to this question]).
To answer the question directly, there is $wpdb->update
but nothing that will strictly duplicate INSERT IGNORE
that I know of. If $wpdb->update
, does not work I am fairly sure that you will need to write your own query and use $wpdb->query
and $wpdb->prepare
.
-
Thank you for your answer. I am obviously trying to do things the Wordpress way, but as I said, I'd tried writing my own query and using query and prepare. THAT SAID, I did NOT do things the Wordpress way when I'd tried that previously in that I was preparing incorrectly! Writing my own query and correcty passing an array of my $vals quieted Wordpress down. Thanks again. – Evan Rose Apr 18 '13 at 15:21
INSERT ... ON DUPLICATE KEY UPDATE ...
– birgire Apr 18 '13 at 14:43INSERT IGNORE
not the done thing? – Evan Rose Apr 18 '13 at 17:51