Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Convert Product Name to UpperCase via SQL


AllThingsTrendy

Recommended Posts

OK. I admin I'm a total novice. I'm new to sql. I'm a spoiled Lotus Notes developer with new clue what I'm doing yet.

 

All of my product names are in UPPERCASE. I know this is vweery vweery bad. Can someone please help me with an sql to conver these to propercase?

 

thanks!!!

Anthony David

AllThingsTrendy.com

Link to comment
Share on other sites

If your product names are more than 1 word then it's not simple to do it in SQL - your best bet would be to knock up a PHP script and use ucwords.

 

Outline:

 

require('includes/application_top.php');

 

$q = tep_db_query('SELECT products_id,products_description FROM ' . TABLE_PRODUCTS);

 

while ($row=tep_db_fetch_array($q))

{

 

tep_db_query('UPDATE ' . TABLE_PRODUCTS . ' SET products_description=\'' . tep_db_input(ucwords(strtolower($row['products_description']))) . '\' WHERE products_id=' . $row['products_id']);

 

}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...