This topic is locked

Custom Code puts £ infront of all Numbers

1/13/2011 7:20:42 AM
PHPRunner General questions
S
swanside author

Hello.

I use this code to display certain information

global $conn;

$sql = "select Title, Quantity, Unit_Price, Quantity*Unit_Price, Quantity*Unit_Price*+Additional_Cost/100,(Quantity*Unit_Price+(Quantity*Unit_Price*+Additional_Cost/100)) from material where job_no='".postvalue("editid1")."'";

$rs = db_query($sql,$conn);

$data = db_fetch_array($rs);

if(!$data)

return;

echo "<table>";

while(1)

{

echo "<tr>";

foreach($data as $v)

{

echo "<td>";

echo htmlspecialchars(format_currency($v));

echo "</td>";

}

echo "</tr>";

if(!($data = db_fetch_array($rs)))

break;

}

echo "</table>";


But, it puts the £ symbol infront of anything with a number in it, so it appears like this
N+E 121458298 - LABELS, CABLE £1.00 £34.17 £34.17 £6.83 £41.00
WHere the £1.00 is Quantity so I dont need any £ for that.
Is there a way around this?

Thanks

Paul.

Sergey Kornilov admin 1/13/2011

Paul,
do not apply format_currency() function to Quantity field. Display it as is.