I’m trying to put together a plugin script that takes a range of values from various locations including csv and strings them together to update existing rows in my db. It’s designed to update prices for WP Ecommerce, when you start with just a sku and the new price. The first query retrieves the additional info I need from the db, and the string puts the data in the correct order.
I’ve got the values in a string ready to import. But I keep getting the error in the title: “wrong parameter count for mysql_query()”. Can anyone help me out? Have I done something fundamentally wrong here?
$result = mysql_query("SELECT * FROM `wp_postmeta` WHERE `post_id` = (SELECT `post_id` FROM `wp_postmeta` WHERE `meta_value` = '$var') AND `meta_key` = '_wpsc_price'") or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
//Collates all the info for the line of data we need...
$my_string = ($row['meta_id'].$row['post_id'].$row['meta_key'].$data[$index-1]);
global $wpdb;
$update = mysql_query("REPLACE TABLE 'wp_postmeta' VALUES ($my_string)",
mysql_real_escape_string($meta_id),
mysql_real_escape_string($post_id),
mysql_real_escape_string($meta_key),
mysql_real_escape_string($meta_value));
}
So really your query goes
changing the name of datafield to whichever it should be