PupStar Posted February 2, 2010 Posted February 2, 2010 Hi Guys, I wonder if anyone could lay these errors out in lamons terms for me please as I am giving myself a headache in trying to debug the code I have. INSERT INTO products_options_values (language_id, products_options_values_name) VALUES ('1', 'Pink')\r\nArray [sql failure] REPLACE INTO products_options_values_to_products_options (products_options_id, products_options_values_id) VALUES (0, ) [sql failure] INSERT INTO products_attributes (products_id, options_id, options_values_id, options_values_price, price_prefix) VALUES (6, 0, , 0, '+') \r\nArray Many Thanks in advance PS
MrPhil Posted February 2, 2010 Posted February 2, 2010 In layman's terms... INSERT INTO products_options_values (language_id, products_options_values_name) VALUES ('1', 'Pink')\r\nArray It looks OK through 'Pink'), but then you have a carriage-return-linefeed (end of line) and some random word "Array". Apparently you failed to end your SQL statement string, and ran into some other code following, i.e., mysql_query("INSERT INTO products_options_values (language_id, products_options_values_name) VALUES ('1', 'Pink') Array"); REPLACE INTO products_options_values_to_products_options (products_options_id, products_options_values_id) VALUES (0, ) You specify that you are replacing a record with two fields being updated, and you supply only one value. The second field (products_options_values_id) has no value. INSERT INTO products_attributes (products_id, options_id, options_values_id, options_values_price, price_prefix) VALUES (6, 0, , 0, '+') \r\nArray Same problem as the first message... an extra "Array" in the query. Plus you're missing one of the values in the list (the third value). 5 fields specified, but only 4 values given.
PupStar Posted February 3, 2010 Author Posted February 3, 2010 Hi Phil, Thank you for taking the time to explain that to me (my head is still buzzing lol) Ok I have spent hours now trying to debug this with not much success (well non actually) Any chance you could have a quick skim through the code below and see if you can see what I am not. Sometimes a fresh pair of eyes is required. <?php //The english language ID define('LANGUAGE_ID', 1); define('SUPPLIER_CODE', 'PUCKATOR'); define('DEBUG',false); define('CATEGORY_UNKNOWN_ID', -1); /* MySQL data /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ include_once('mysql.php'); include_once('../includes/configure.php'); class LiveStoreProductsImporter { public $minimum_number_of_products_active, $parent_category; function __construct ($since = '') { $this->get_puckator_configuration(); } //Gets the minimum number of products to be active function get_puckator_configuration() { global $db; $sql = "SELECT configuration_value, configuration_key FROM configuration WHERE configuration_group_id=1500"; if (!$live_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } while ($row = $db->sql_fetchrow($live_result)) { if ($row['configuration_key'] == "MINIMUM_NUMBER_OF_PRODUCTS_ACTIVE") { $this->minimum_number_of_products_active = $row['configuration_value']; } elseif ($row['configuration_key'] == "PARENT_CATEGORY") { $this->parent_category = $row['configuration_value']; } } } public function report ($message) { echo "<p style='font-size:10px;font-family:Verdana;color:navy'>$message</p>"; } //Calculates net prices static function get_net_price ($supplier_price, $delivery_fee = 0) { return (float)$supplier_price; } //Rounds price to .49 or .99 static function round_price ($price) { if ($price < 0.75) return 0.49; $price_int = floor((float)$price); $price_dec = (float)$price - (float)$price_int; if ($price_dec < 0.25) { return (float)$price_int - 0.01; } elseif ($price_dec < 0.75) { return (float)$price_int + 0.49; } else { return (float)$price_int + 0.99; } } function GetParentCategoryId($supplier_cat_id) { global $db; $sql = "SELECT parent_id FROM puck_categories where supplier_cat_id = $supplier_cat_id"; if (!$puck_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } if ($row = $db->sql_fetchrow($puck_result)) { $parent_id = $row['parent_id']; $sql = "SELECT supplier_cat_id FROM puck_categories where categories_id = $parent_id"; if (!$puck_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } if ($row = $db->sql_fetchrow($puck_result)) { $supplier_parent_cat_id = $row['supplier_cat_id']; $parent_id = $this->GetCategoryID($supplier_parent_cat_id); return $parent_id?$parent_id:CATEGORY_UNKNOWN_ID; } } } function GetTopCategoryId() { if (empty($this->parent_category)) { return 0; } global $db; $sql = "SELECT categories_id FROM categories_description where categories_name like '{$this->parent_category}'"; if (!$result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } if ($row = $db->sql_fetchrow($result)) { return $row['categories_id']; } else { $sql = "INSERT INTO categories (parent_id, date_added) VALUES(0, NOW())"; if (!$result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } if (!$parent_category_id = $db->sql_nextid()) { $this->report("[sql failure] No category id returned for $sql, although the query was successful."); die(); } $sql = "REPLACE INTO categories_description (categories_id, language_id, categories_name) VALUES ($parent_category_id, " . LANGUAGE_ID . ", '{$this->parent_category}')"; if (!$result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } return $parent_category_id; } } public function GetCategoryID ($supplier_cat_id) { global $db; $sql = "SELECT categories_id FROM categories WHERE supplier_code = '" . SUPPLIER_CODE . "' AND supplier_cat_id = $supplier_cat_id"; if (!$result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql); return; } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } $row = $db->sql_fetchrow($result); return $row['categories_id']; } public function GetProductID ($pid) { global $db; $sql = "SELECT products_id FROM products WHERE products_model = '$pid'"; if (!$result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql); return; } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } $row = $db->sql_fetchrow($result); return $row['products_id']; } function ImportProductsToCategories() { global $db; $sql = "SELECT products_id, categories_id FROM puck_products_to_categories"; if (!$result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } while ($row = $db->sql_fetchrow($result)) { $products_id = $row['products_id']; $categories_id = $row['categories_id']; $sql = "SELECT products_model FROM puck_products WHERE products_id = $products_id"; if (!$puck_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($puck_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } $row = $db->sql_fetchrow($puck_result); $pid = $row['products_model']; $pro_id = $this->GetProductId($pid); $sql = "SELECT supplier_cat_id FROM puck_categories WHERE categories_id = $categories_id"; if (!$puck_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($puck_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } $row = $db->sql_fetchrow($puck_result); $supplier_cat_id = $row['supplier_cat_id']; $cat_id = $this->GetCategoryID($supplier_cat_id); $sql = "REPLACE INTO products_to_categories (products_id, categories_id) VALUES ($pro_id, $cat_id)"; if (!$live_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } } } function ImportProducts () { global $db; $sql = "SELECT products_id FROM puck_products"; if (!$result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } while ($row = $db->sql_fetchrow($result)) { $products_id = $row['products_id']; $this->ImportProduct($products_id); } } function ImportProduct ($id) { global $db, $numberOfProductsInactive; //Retrieves all the products data from puck table $sql = "SELECT products_model, products_id, products_quantity, products_image, products_price, products_date_added, products_weight, products_status, manufacturers_id FROM puck_products where products_id = $id"; $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) { $pid = $row['products_model']; $sql = "SELECT products_id, products_status FROM products WHERE products_model = '$pid'"; if (!$live_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } $price = $this->get_net_price($this->GetProductIncreasedPrice($id, $row['products_price'])); $stock = intval($row['products_quantity']); $image = $row['products_image']; $weight = ''; //TODO: $manufacturer_id = $row['manufacturers_id']; $products_id = $row['products_id']; if ($stock < $this->minimum_number_of_products_active) { $status = 0; $numberOfProductsInactive++; } else { $status = 1; } if (!$row = $db->sql_fetchrow($live_result)) { //Insert into live products table $sql = "INSERT INTO products (products_model, products_quantity, products_image, products_price, products_date_added, products_weight, products_status, manufacturers_id) VALUES ('$pid', $stock, '$image', $price, NOW(), '$weight', $status, '$manufacturer_id')"; if (!$live_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } if (!$product_id = $db->sql_nextid()) { $this->report("[sql failure] No product id returned for $sql, although the query was successful."); } } else { //Updates products $product_id = $row['products_id']; $sql = "UPDATE products SET products_quantity = $stock, products_image = '$image', products_price = $price, products_last_modified = NOW(), products_weight = '$weight', manufacturers_id = '$manufacturer_id', products_status = $status WHERE products_id = $product_id; "; if (!$live_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } } //Import data in products_description table $sql = "SELECT products_id, language_id, products_name, products_description FROM puck_products_description WHERE products_id = $products_id AND language_id = " . LANGUAGE_ID; if (!$puck_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($puck_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } $row = $db->sql_fetchrow($puck_result); $lang = $row['language_id']; $name = $db->sql_escape($row['products_name']); $description = $db->sql_escape($row['products_description']); $sql = "SELECT products_id FROM products_description WHERE products_id = $product_id AND language_id = " . LANGUAGE_ID; if (!$live_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } if (!$row = $db->sql_fetchrow($live_result)) { //New product $sql = "INSERT INTO products_description (products_id, language_id, products_name, products_description) VALUES ($product_id, $lang, '$name', '$description')"; if (!$live_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } else { $this->report("[$name] - Updated"); } if (!$products_id = $db->sql_nextid()) { $this->report("[sql failure] No product id returned for $sql, although the query was successful."); return; } } else { //Updates products description $sql = "UPDATE products_description SET products_name = '$name', products_description = '$description' WHERE products_id = $product_id AND language_id = $lang"; if (!$live_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } else { $this->report("[$name] - Updated"); } } $sql = "DELETE FROM products_attributes WHERE products_id = $product_id"; if (!$db->sql_query($sql)) { $this->report('[sql failure] ' . $sql); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } $sql = "SELECT products_id, options_id, options_values_id, options_values_price, price_prefix FROM puck_products_attributes WHERE products_id = $id ORDER BY products_id, options_id"; if (!$puck_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($puck_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } $puck_options_id = 0; $options_id = 1; while ($row = $db->sql_fetchrow($puck_result)) { if ($row['options_id'] != $puck_options_id) { $options_id = $this->ImportProductOption($row['options_id']); $puck_options_id = $row['options_id']; } $options_values_id = $this->ImportProductOptionsValue($row['options_values_id']); $sql = "REPLACE INTO products_options_values_to_products_options(products_options_id, products_options_values_id) VALUES ($options_id, $options_values_id)"; if (!$db->sql_query($sql)) { $this->report('<b><u>[sql failure] ' . $sql . '</u></b>'); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } $sql = "INSERT INTO products_attributes(products_id, options_id, options_values_id, options_values_price, price_prefix) VALUES ($product_id, $options_id, $options_values_id, 0, '+')"; if (!$live_result = $db->sql_query($sql)) { $this->report('<b><u>[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result) . '</u></b>'); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } } } } function ImportCategories () { global $db; $sql = "SELECT categories_id FROM puck_categories"; if (!$result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } while ($row = $db->sql_fetchrow($result)) { $categories_id = $row['categories_id']; $this->ImportCategory($categories_id); } } //Fix parent categories not yet known during parsing, not public, ... public function FixCategories() { global $db; $sql = "SELECT categories_id, supplier_cat_id FROM categories WHERE parent_id = " . CATEGORY_UNKNOWN_ID . " AND supplier_code LIKE '" . SUPPLIER_CODE . "'"; if (!$result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } while ($row = $db->sql_fetchrow($result)) { //Gets the supplier parent cat id $parent_cat_id = $this->GetParentCategoryID($row['supplier_cat_id']); $sql = "UPDATE categories SET parent_id = $parent_cat_id WHERE categories_id = {$row['categories_id']}"; $db->sql_query($sql); } } function ImportCategory ($id) { global $db; $sql = "SELECT categories_id, categories_image, parent_id, supplier_code, supplier_cat_id FROM puck_categories WHERE categories_id = $id"; if (!$result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } if ($row = $db->sql_fetchrow($puck_result)) { $this->parent_category = $this->GetTopCategoryId(); $categories_id = $row['categories_id']; $categories_image = $row['supplier_cat_id']; $parent_id = $row['parent_id']==0?$this->parent_category:$this->GetParentCategoryId($row['supplier_cat_id']); $supplier_code = $row['supplier_code']; $supplier_cat_id = $row['supplier_cat_id']; if (!$cat_id = $this->GetCategoryID($supplier_cat_id)) { $sql = "INSERT INTO categories (categories_image, parent_id, date_added, supplier_code, supplier_cat_id) VALUES ('$categories_image', $parent_id, NOW(), '$supplier_code', $supplier_cat_id)"; if (!$live_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } if (!$cat_id = $db->sql_nextid()) { $this->report("[sql failure] No category id returned for $sql, although the query was successful."); return; } } else { $sql = "UPDATE categories SET categories_image = '$categories_image', parent_id = $parent_id, last_modified = NOW(), supplier_code = '$supplier_code', supplier_cat_id = $supplier_cat_id WHERE categories_id = $cat_id"; if (!$live_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } } $sql = "SELECT categories_name, language_id FROM puck_categories_description WHERE categories_id = $categories_id"; if (!$puck_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($puck_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } if ($row = $db->sql_fetchrow($puck_result)) { $categories_name = $row['categories_name']; $lang = $row['language_id']; $sql = "REPLACE INTO categories_description(categories_id, language_id, categories_name) VALUES ($cat_id, $lang, '$categories_name')"; if (!$live_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } else { $this->report("[$categories_name] - Updated"); } } } } function GetProductIncreasedPrice($id, $price) { global $db; $puck_result = $db->sql_query("SELECT c.price_increase FROM puck_products_to_categories as p JOIN puck_categories as c ON p.categories_id = c.categories_id WHERE p.products_id = $id"); $row = $db->sql_fetchrow($result); $price_increase = $row['price_increase']?$row['price_increase']:0; return floatval($price)/100*(100+floatval($price_increase)); } function ImportProductOptionsValue($id) { global $db; //Insert product options values $sql = "SELECT language_id, products_options_values_name FROM puck_products_options_values WHERE products_options_values_id = $id"; if (!$puck_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($puck_result)); return; } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } if ($row = $db->sql_fetchrow($puck_result)) { $products_options_values_name = $row['products_options_values_name']; $lang = $row['language_id']; $sql = "SELECT language_id, products_options_values_id FROM products_options_values where products_options_values_name LIKE '$products_options_values_name'"; if (!$live_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); return; } elseif (DEBUG) { //$this->report('[sql ok] ' . $sql); } if ($row = $db->sql_fetchrow($live_result)) { return $row['products_options_values_id']; } else { $sql = "INSERT INTO products_options_values(language_id, products_options_values_id, products_options_values_name) VALUES ('$lang', '$products_options_values_name')"; if (!$live_result = $db->sql_query($sql)) { $this->report('<b><u>[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result) . '</u></b>'); return false; } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } if (!$products_options_values_id = $db->sql_nextid()) { $this->report("[sql failure] No products options values id returned for $sql, although the query was successful."); return false; } return $products_options_values_id; } } } function ImportProductOption($id) { //Insert product options global $db; $sql = "SELECT language_id, products_options_name FROM puck_products_options WHERE products_options_id = $id"; if (!$puck_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($puck_result)); return; } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } if ($row = $db->sql_fetchrow($puck_result)) { $products_options_name = $row['products_options_name']; $lang = $row['language_id']; $sql = "SELECT language_id, products_options_id FROM products_options WHERE products_options_name LIKE '$products_options_name'"; if (!$live_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); return; } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } if ($row = $db->sql_fetchrow($live_result)) { return $row['products_options_id']; } else { $sql = "INSERT INTO products_options(language_id, products_options_name) VALUES ('$lang', '$products_options_name')"; if (!$live_result = $db->sql_query($sql)) { $this->report('[sql failure] ' . $sql . '\r\n' . $db->sql_error($live_result)); return false; } elseif (DEBUG) { $this->report('[sql ok] ' . $sql); } if (!$products_options_id = $db->sql_nextid()) { $this->report("[sql failure] No products options id returned for $sql, although the query was successful."); return false; } return $products_options_id; } } } function ImportFromPuckTables () { $this->ImportCategories(); $this->FixCategories(); $this->ImportProducts(); $this->ImportProductsToCategories(); } } $db = new sql_db(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, false); if (!$db->db_connect_id) { die(mysql_error()); } echo <<<PAGE <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Puckator Importer</title> <script src="scripts/categories.js" language="javascript" type="text/javascript"></script> <link href="styles/style.css" rel="stylesheet" type="text/css"/> </head> <body> <table cellpadding="0" cellspacing="0" width="100%"> <tr><td align="center"><img src="images/puckator_live_update.gif" alt="Puckator Logo"></td></tr> <tr> <td> </td> </tr> <tr><td align="center"> <div id="divLoading"> <table cellpadding="0" cellspacing="0" width="100%"> <tr> <td valign="middle" align="center"> <img src="images/loading.gif" alt="Loading..."> </td> </tr> <tr> <td valign="middle" style="text-align: center;" class="report_header">Please wait as this may take a while depending on how many categories you have selected to import.</td> </tr> </table> </div> </td></tr> </table> <table cellpadding="0" cellspacing="0" width="100%"> <tr><td align="center"> PAGE; $numberOfProductsInactive = 0; $livestoreImporter = new LiveStoreProductsImporter(); $livestoreImporter->ImportFromPuckTables(); echo <<<PAGE <table cellpadding="0" cellspacing="0" width="400px"> <tr> <td class="report_header" colspan="2" style="text-align:center;">Update Live Store Report</td> </tr> <tr> <td class="report_field">Number Of Products Inactive:</td> <td class="report_value">$numberOfProductsInactive</td> </tr> </table> <table cellpadding="0" cellspacing="0" width="400px"> <tr> <td> </td> </tr> <tr> <td> <div class="buttons"> <button type="button" class="positive" onclick="document.location.href='../puck_categories.php'"><img src="images/return_in.gif" alt="Click here to go to the admin."/> Back To Admin </button> </div> </td> </tr> </table> </td></tr> </table> <script language="javascript" type="text/javascript"> document.getElementById("divLoading").innerHTML=""; </script> </body> </html> PAGE; ?>
MrPhil Posted February 3, 2010 Posted February 3, 2010 I don't see the exact code you listed in your first post, but I do see some errors: about line 925 $sql = "INSERT INTO products_options_values(language_id, products_options_values_id, products_options_values_name) VALUES ('$lang', '$products_options_values_name')"; You list three fields to update, but give only two values. Fixing the missing value may get rid of the "Array" bit. about line 643 $sql = "REPLACE INTO products_options_values_to_products_options(products_options_id, products_options_values_id) VALUES ($options_id, $options_values_id)"; That's probably where the second error is, which would mean that the variable $options_values_id is empty or undefined. You could insert a line before to display the value of that variable, and start tracing back as to what happened to it. about line 656 $sql = "INSERT INTO products_attributes(products_id, options_id, options_values_id, options_values_price, price_prefix) VALUES ($product_id, $options_id, $options_values_id, 0, '+')"; Same problem as line 643: $options_values_id has no value. Fixing the missing value may get rid of the "Array" bit. about line 1124 PAGE; That should appear as literally PAGE; in your HTML output. I assume it's an error.
PupStar Posted February 3, 2010 Author Posted February 3, 2010 I don't see the exact code you listed in your first post, but I do see some errors: about line 925 $sql = "INSERT INTO products_options_values(language_id, products_options_values_id, products_options_values_name) VALUES ('$lang', '$products_options_values_name')"; You list three fields to update, but give only two values. Fixing the missing value may get rid of the "Array" bit. about line 643 $sql = "REPLACE INTO products_options_values_to_products_options(products_options_id, products_options_values_id) VALUES ($options_id, $options_values_id)"; That's probably where the second error is, which would mean that the variable $options_values_id is empty or undefined. You could insert a line before to display the value of that variable, and start tracing back as to what happened to it. about line 656 $sql = "INSERT INTO products_attributes(products_id, options_id, options_values_id, options_values_price, price_prefix) VALUES ($product_id, $options_id, $options_values_id, 0, '+')"; Same problem as line 643: $options_values_id has no value. Fixing the missing value may get rid of the "Array" bit. about line 1124 PAGE; That should appear as literally PAGE; in your HTML output. I assume it's an error. Thanks for looking and I have tried a few things but I just can not see it urgh and its driving me bloomin nuts!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.