Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL backup - help please!


braided

Recommended Posts

Hi there,

 

I am unhappy with changes I made to my products and wish to go back in time. I would use the restore function but I dont want to lose customer details since I made the changes.

 

I have looked at replacing just the sql I need to with a saved backup, each table starts with PRIMARY KEY which i have seperated ready to copy and paste into my database.

 

My question is, is what i am trying to do possible and if so how do you replace the data? What character set are the backups in and Will i need to drop the table first?

 

Thanks alot

Link to comment
Share on other sites

phpMyadmin would probably help out quite a bit if you don't already have it.

 

Yes, you should clear or drop the particular table then insert the old data. Character set shouldn't be an issue (or, at least, I've never had an issue with it).

 

http://www.phpmyadmin.net/home_page/

 

Iggy

Everything's funny but nothing's a joke...

Link to comment
Share on other sites

Hi, thanks for that, I think i have a valid backup.

Yes I have phpmyadmin. Do i run the query from "PRIMARY KEY (categories_id), KEY idx_categories_parent_id .... etc " Up to the start of the next primary key for each table i want to replace?

Link to comment
Share on other sites

Hi, thanks for that, I think i have a valid backup.

Yes I have phpmyadmin. Do i run the query from "PRIMARY KEY (categories_id),  KEY idx_categories_parent_id .... etc " Up to the start of the next primary key for each table i want to replace?

 

If you dropped the table entirely copy/paste the set of commands that look like this into the "Run SQL Queries" form under the SQL tab

 

CREATE TABLE `products` (

`products_id` int(11) NOT NULL auto_increment,

`products_quantity` int(4) NOT NULL default '0',

`products_model` varchar(12) default NULL,

`products_image` varchar(64) default NULL,

`products_mediumimage` varchar(64) default NULL,

`products_largeimage` varchar(64) NOT NULL default '',

`image_square` varchar(64) default NULL,

`products_price` decimal(15,4) NOT NULL default '0.0000',

`products_date_added` datetime NOT NULL default '0000-00-00 00:00:00',

`products_last_modified` datetime default NULL,

`products_date_available` datetime default NULL,

`products_weight` decimal(5,2) NOT NULL default '0.00',

`products_status` tinyint(1) NOT NULL default '0',

`products_tax_class_id` int(11) NOT NULL default '0',

`manufacturers_id` int(11) default NULL,

`products_ordered` int(11) NOT NULL default '0',

`products_price1` decimal(15,4) NOT NULL default '0.0000',

`products_price2` decimal(15,4) NOT NULL default '0.0000',

`products_price3` decimal(15,4) NOT NULL default '0.0000',

`products_price4` decimal(15,4) NOT NULL default '0.0000',

`products_price5` decimal(15,4) NOT NULL default '0.0000',

`products_price6` decimal(15,4) NOT NULL default '0.0000',

`products_price7` decimal(15,4) NOT NULL default '0.0000',

`products_price8` decimal(15,4) NOT NULL default '0.0000',

`products_price1_qty` int(11) NOT NULL default '0',

`products_price2_qty` int(11) NOT NULL default '0',

`products_price3_qty` int(11) NOT NULL default '0',

`products_price4_qty` int(11) NOT NULL default '0',

`products_price5_qty` int(11) NOT NULL default '0',

`products_price6_qty` int(11) NOT NULL default '0',

`products_price7_qty` int(11) NOT NULL default '0',

`products_price8_qty` int(11) NOT NULL default '0',

`products_qty_blocks` int(11) NOT NULL default '1',

PRIMARY KEY (`products_id`),

KEY `idx_products_date_added` (`products_date_added`)

) TYPE=MyISAM AUTO_INCREMENT=1084 ;

 

Don't use this example though as it's had some mods applied to it.

 

If you just cleared the table out then all you want is the insert statements, ie:

 

INSERT INTO `products` VALUES (1, 774, 'M7UP', '7up.mexico12.gif', '7up.mexico12.m.jpg', '7up.mexico12.jpg', NULL, '0.9900', '0000-00-00 00:00:00', '2005-03-07 08:49:07', NULL, '2.10', 1, 1, 146, 227, '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', 0, 0, 0, 0, 0, 0, 0, 0, 1);

 

Hope that helps!

Iggy

Everything's funny but nothing's a joke...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...