Update prices to end with .99 php / osCommerce

My products price list: 12.2000, 15.5000, 40.0000, 50.8888

If you want to update the prices like..... 12.99, 15.99, 40.99, 50.99

Then try this........

<?php
require('includes/functions/database.php'); require('includes/configure.php');
set_time_limit(0); ini_set("memory_limit","32M");
$stimer = explode( ' ', microtime() ); $stime = $stimer[1] + $stimer[0];
tep_db_connect() or die('Unable to connect to database server!');
$price_query = tep_db_query("select * from products");
while ($price_value = tep_db_fetch_array($price_query)) { $pprice = $price_value['products_price']; //echo $pprice.'<br>'; $upprice = explode(".", $pprice); //echo end($upprice); $sql = "update products set products_price = floor(products_price)+0.99"; //echo $sql.'<br>'; $update_query = tep_db_query($sql);
}
$etimer = explode( ' ', microtime() ); $etime = $etimer[1] + $etimer[0];
$time_spent = round($etime - $stime, 3); exit($time_spent); tep_db_close();
?>

Thanks for visit my blog.

0 Response to "Update prices to end with .99 php / osCommerce"

Article Top Ads


Central Ads Article 1

Middle Ads Article 2

Article Bottom Ads