I saw on here one other guy was having problems with
$wpdb->prepare
. Am I using it incorrectly?
As you can read in the Codex, it’s a simple No.
You have to use it like sprintf/printf()
. The only allowed inputs are
- string:
%s
- digit:
%d
Example
$sql = $wpdb->prepare(
"
INSERT INTO %s
(`post_content`, `imported`)
VALUES %s
ON DUPLICATE KEY UPDATE imported = 1
"
,"{$wpdb->prefix}bugtbl_temp"
,implode( ',', $values )
);
Disclaimer: The ↑ shown query, doesn’t necessarily mean that it will give you results, just because you then used the $wpdb->prepare()
right.