Add Perctage to Query

wxdqz

New Member
Hi,

I'm new to php, and I was wonder if someone could help me with the following situation. I have a function that add a percentage to the database price and sets the two decimal format to that new price. But I can't implement it with the below Query - A WHILE Query. Any help will be greatly appreciated.


Here is the function:
---------------------
//Add Percentage & Round
//Note: percent is a Global Var
function add_percent ($price, $percent) {
$newprice = $price * (1 + ($percent/100));
return number_format($newprice,2);

Call this function by:
----------------------
.add_percent($cost)

Here is the Query
-----------------
case 0:
$query = "SELECT descr, cost, part_num, manu_part FROM products WHERE UPPER(descr) LIKE '%$input%'";

if ($result = mysql_query ("$query")) {
while ($row = mysql_fetch_array ($result))
{
echo "Description: ".$row[descr]." ".$row[cost]."<br>\n";
}
}
break;


Thanks!
Sac Town
 
Back
Top