Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL Genius Needed Please


Jezthomp

Recommended Posts

Am adding the product sort cont and needed to upload the following sql:

 

ALTER TABLE products ADD `products_sort_order` INT(3);

 

INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (263, 'Display Product Sort Order', 'PRODUCT_SORT_ORDER', '0', 'Do you want to display the Product Sort Order column?', 8, 29, '', '', NULL, NULL);

 

But i get the following error

 

Error

SQL-query:

 

ALTER TABLE products ADD `products_sort_order` INT( 3 )

MySQL said: 

 

#1060 - Duplicate column name 'products_sort_order'

 

What am i doing wrong i didnt change the orginal sql at all or do i need to?

 

Dont like phpmyadmin cause dont have a clue how it works and dont want to to ruin my site :(

 

Any help

 

Thankyou

Link to comment
Share on other sites

I'm far from a genius, let alone an SQL Genius so I'm hesitant to answer....

 

IMHO MySQL is telling you that there is already a column "products_sort_order" in the table "products". But you can easily check that with PHPMyAdmin yourself.

 

If that column is indeed already in the table, then I would say that you can run that SQL query without the ALTER .....INT(3); statement and be fine. Making a db-backup won't hurt of course ;-)

Link to comment
Share on other sites

In the admin section (/catalog/admin/) there is on the bottom right a link to "Tools" and backup. There you can make a backup of the database and restore it also if something goes wrong. From the top of my head I think you do have to manually (with FTP or something like that) make a backup directory (/catalog/admin/backups is I think the default). Has to writable and such for the webserver and perhaps you even have to put the name of the backup directory in /admin/includes/configure.php . Perhaps there is more information in the Knowledge Base, haven't checked.

 

Being able to backup the database is pretty important in my opinion...

Link to comment
Share on other sites

also, from a query window, you could just make a copy of the current table in the database.

 

select * into backup_products from products

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...