Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Yikes. Attributes not inserting


Guest

Recommended Posts

Posted

1136 - Column count doesn't match value count at row 1



insert into products_attributes values ('', '1051', '1', '10', '0', '')

 

Help, my attributes arent being inserted into the database. Just installed the alternate attribute handling with big images merge.

 

What am I doing wrong here???

 

Thanks in Advance!

 

Please ignore my partners test images :)

http://www.partytimeproducts.com/catalog/default.php

Posted

Do you have more or less fields than defined there? That insert contains 6 fields. How many do you have in your products_attributes table?

Posted

Hey Linda Thanks for responding.

 

Looks likeI have ten fields somehow. Not sure what to do next here. Any ideas? Thanks soooo much! :?

 

   products_attributes_id  int(11)  



  products_id  int(11)   



  options_id  int(11)   



  options_values_id  int(11)   



  options_values_price  decimal(15,4)  



  price_prefix  varchar(5)   



  options_type_id  smallint(6)   



  options_values_qty  int(11)   



  attribute_order  smallint(6)   



  collegamento  int(11)

Posted

You need to edit the insert statement then to include values for all of your fields.

Posted

I just ran the query on the attr table again.

 

DROP TABLE IF EXISTS products_attributes;

CREATE TABLE products_attributes (

 products_attributes_id int NOT NULL auto_increment,

 products_id int NOT NULL,

 options_id int NOT NULL,

 options_values_id int NOT NULL,

 options_values_price decimal(15,4) NOT NULL,

 price_prefix char(1) NOT NULL,

 PRIMARY KEY (products_attributes_id)

);

 

Think I have it. works great now :) Thanks, for the hint :) Cya. L8R

  • 2 months later...
Posted

I think it can fixed by this short way:

 

tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values ('', '" . $products_id . "', '" . $options['products_options_id'] . "', '" . $values['products_options_values_id'] . "', '" . $HTTP_POST_VARS['price'][$rows] . "', '" . $HTTP_POST_VARS['prefix'][$rows] . "')");

 

tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . "(products_attributes_id, products_id, options_id, options_values_id, options_values_price, price_prefix) values ('', '" . $products_id . "', '" . $options['products_options_id'] . "', '" . $values['products_options_values_id'] . "', '" . $HTTP_POST_VARS['price'][$rows] . "', '" . $HTTP_POST_VARS['prefix'][$rows] . "')");

 

 

 

zaenal

Posted

Actually not a good plan ... :shock:

 

The products_attributes_id is an autoincrement field which is why the insert has that value as '' and does not have it defined ... this lets it autoincrement ... :D

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...