Posts: 130
Location: Atlanta, Georgia
|
<?
$var = mysql_query("SELECT * FROM Title");
while ($arr = mysql_fetch_array($var)){
$temp = $arr[TITLEID];
$titleid = str_replace(' ', ' ', $arr[TITLEID]);
mysql_query("UPDATE Title SET TITLEID='$titleid' WHERE TITLEID='$temp'")
}
?>
The code above will replace all of the spaces in your title ID's and change them to 's. As for the other query, I'm not sure what you want, so I'll just write a small thing to make the dealer price a percentage of that of the price.
<?
$percentageoff = '.25'; // Dealer gets 25% off!
$var = mysql_query("SELECT * FROM Title");
while ($arr = mysql_fetch_Array($var)){
$dealerprice = $arr[price]*$percentageoff;
mysql_query("UPDATE Title SET Dealer_price='$dealerpice' WHERE Price='$arr[price]'");
}
?>
That code should change all of the dealer prices to 25% (in your example, 15/20 = 25% off) of the regular price posted, you can change the value of $percentageoff to whatever you'd like.
__________________
Logical Programming - For all of your website programming and design needs, make the logical choice. Logical Assistance For Real-World Clients.
|