Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL Error when trying to duplicate products


Benjjj6

Recommended Posts

Hi

 

When I try to duplicate a product via the Admin panel I get the following error message after I click 'copy' and the product is not duplicated:

 

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

insert into products (products_quantity, products_model, products_image, products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, manufacturers2_id) values ('0', '', 'ts_db_blackme.jpg', '', '', '', '', '', '', '11.9900', now(), '', '0.00', '0', '0', '509')

[TEP STOP]

 

 

Obviously I do have a number of contributions installed that would affect this process, although was hoping you might be able to tell me what exactly is causing this problem?

 

Thanks,

 

Ben

Link to comment
Share on other sites

your message 'Column count doesn't match value count at row 1' means that the number of columns specified in your insert statement (the products_quantity, products_model, products_image, etc.) doesn't match the number of values specified (the '0', '', 'ts_db_blackme.jpg', etc.). you have 17 columns and 16 values so mysql doesn't know what you really want to do...and it's not willing to guess. :)

 

since you've made changes, it's hard for anyone to guess where the problem started. go back to the install instructions for each of those contributions and look at this insert. you can narrow it down to the .php file that you're using when you get this error. you must have missed adding one of the values to the statement. there are a lot of empty ('') values, so maybe you skipped one.

Link to comment
Share on other sites

Hey Dave, thanks for your response.

 

you can narrow it down to the .php file that you're using when you get this error.

By this do you mean I can examine my categories.php to find out which contribution's edited the file and which could affect the process?

 

If so, then I guess I only need to look at any SQL queries that I ran when I added the contrib. But, I havent experienced this problem anywhere else on my site, do you know why it would only affect the copy/duplicate function?

 

Also, I forgot to add that my admin page looks like this:

buttonsrf3.gif

 

As you can see I have all the buttons duplicated apart from 'Related Products', I'm not sure when this happened, but may be related to the problem Im having?

 

Would you be willing to view my categories.php file to see what could be causing the problem?

Link to comment
Share on other sites

By this do you mean I can examine my categories.php to find out which contribution's edited the file and which could affect the process?

 

if this is the file being run when you get this error, then yes - it should be the only one that needs to be examined.

 

If so, then I guess I only need to look at any SQL queries that I ran when I added the contrib. But, I havent experienced this problem anywhere else on my site, do you know why it would only affect the copy/duplicate function?

 

the queries you ran when you installed the contrib are not the queries that are causing the problem. that may sound confusing, but think of this: those sql queries may have modified the tables or added some configuration settings. they are not the query that is inside the code that is being executed now.

 

however, part of those install instructions very likely had you modify the statement that is causing the problem. it may have added the column name to the query. it should also have added the value for that column name to the values() clause of the statement. that's the part you should double check. look at the instructions that pertain to categories.php and double check all the modifications to the sql statements.

 

Also, I forgot to add that my admin page looks like this:

i don't know why that would be happening. it's not related to your sql problem since that's an insert (adding data) and not related to drawing those buttons. but it may well have happened when you made the modifications with your contrib.

 

Would you be willing to view my categories.php file to see what could be causing the problem?

 

not just yet. :) besides, i told you what's causing the problem: the columns and values are mismatched. you need to find out the why.

 

how about you try looking at those instructions first? if i looked at the code i wouldn't know what's missing anyway, i'd need a lot more information. like the instructions for the contrib. and depending on what other changes you've made it may mean multiple contribs. for all i know the instructions you have told you to remove something from that statement instead of add something. both can have the same result. so give it a shot and let me know how it goes.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...