Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

MySQL script please?????


hankfrid

Recommended Posts

Posted

Can someone give me an example of a MySQL script that could be run, say in PhpMyAdmin that would do this simple task?

 

I want to have a script that would go down thru a table(Table1) and for each entry in the database, take the data from one field (FieldA) and populate/replicate the data to another field (FieldB) within the same table and post the update to the database.

 

I know this is probably a real simple script, but I haven't even started to dabble in MySQL yet, except for basic Select/Where. I'm having too much fun with PHP still.

 

Thanks in advance.

 

HankFrid

If I build it...they will come.

If I don't try to build it.....I will never know!

Posted

If i understand what you need then operator must be:

 

UPDATE tablename SET FieldB = FieldA;

 

This will set FieldB equal to FieldA in ALL rows.

There is always more than one way to do it.

And always Keep It Simple, Stupid.

Posted

Yes, it is all in the same table, so I believe the script already given here gives me exactly what I need. Thanks so much for such a quick response.

 

I am working on a contribution and I wanted to provide this script, so that once the table updates are done to add a couple of fields, a script can be run to set an initial value equal to a pre-existing field on the database.

 

I'm working on applying the Small, Medium, Large Picture contribution, but I had to do some retrofitting of the code in Admin/categories.php.

 

While I'm at it, I'm setting it up so that it will automatically have your existing image populated to the medium and large image fields. I am also modifying it so that when you're in Admin setting up a new product, if you don't specify a file name for medium image, it will copy and use what is in small image. For the large, I check for medium to use, then small. That way there should be NO broken images, as long as you at least specify a small/regular image file.

 

Thanks again.

 

HankFrid

If I build it...they will come.

If I don't try to build it.....I will never know!

Archived

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

×
×
  • Create New...