Help the multiplication

  1. / Your code after this line:

“.$row[“giathue”].”

  1. / Now I want to do multiplication with a variable in the config.php file, that variable is a number.

<?php
$itemshow = 3;
$page = ($pages-1)*$itemshow;
$stt = $page;
$orderby = " ORDER BY “.(isset($_GET[“sort”])?“giathue “.($_GET[“sort”]==“asc”?“ASC”:“DESC”):“lastupdate DESC”);
$tsort = isset($_GET[“sort”])?”&sort=”.$_GET[“sort”]:”“;
$SQLString = “SELECT * FROM tin1p WHERE duyet=1 “.(isset($_GET[“quan”])?“AND quan='”.$_GET[“quan”].”'”:”“);
$result = mysql_query($SQLString);
$num_rows = mysql_num_rows($result);
if ($num_rows){
$SQLString = “SELECT * FROM tin1p WHERE duyet=1 “.(isset($_GET[“quan”])?“AND quan='”.$_GET[“quan”].”'”:”“).$orderby.” limit $page, $itemshow";
$result = mysql_query($SQLString);
while ($row = mysql_fetch_array($result))
{
$hinhanh = ret_value(“hinhanh”,“WHERE thutu=1 AND parent=”.$row[“parent”]." AND phienlamviec=“.$row[“phienlamviec”],“duongdan”);
if (!isset($_SESSION[$chitiet]))
{
echo isset($_SESSION[$chitiet])?”“:”“;
$_SESSION[$chitiet] = $baygio;
$solanxem = $row[“solanxem”]+1;
ret_edit_value(”“,“tin1p”,“id=”.$chitiet,“solanxem “,$solanxem);
}
echo “<td width=\“30%\” valign=\“top\” style=\“font-size:12px\”>
<a href=\”\” class=\“small-hotnews-image-\”>
<img style=\“width: 70px;height: 70px;border:3px solid #caccc9;float:left;margin-right:5px\” class=\“sh-news-\” src=\“http://dangkyoffice.com/…”.(strlen($hinhanh)?$hinhanh:”/hide.gif”).“\” />
</a>
<a href=\“http://vanphong.cenrea.com/van-phong-cho-thue-“.$row[“id”].”-“.ret_bo_dau_vn($row[“tentoanha”],”-“).”-duong-“.ret_bo_dau_vn($row[“diachi”],”-“).”-“.$row[“quan”].”.html\\” class=\“hotnews-title-\” style=\“margin-top:5px\” target=\“_Blank\”>“.$row[“tentoanha”].”</a>
<br />“.$quan_array[$row[“quan”]].”
<br />“.$row[“giathue”].” USD/m2
</td>";
}
}
?>

I want to transfer currency is the dollar amount to Vietnam

Thank you very much!

I would set a variable at the top of the code e.g. $excahange_rate = ‘1.2’; for the conversion rate so it is easy to find and change then try changing:


<br />".$row["giathue"]." USD/m2
to
<br />".( $row["giathue"] * $excahange_rate )." USD/m2

Assuming that is the row with the currency in.

What rubble said was correct, but I would like to make a couple additional comments:[LIST=1]
[]You don’t need to assign the variable in quotes - in fact, it’s more efficient not to as the server won’t have to convert the value before it can do the math.
[
]Please, please, PLEASE do not handle your querystrings like that - you are setting yourself up for SQL injection and problems down the line. I would suggest reading these three threads to solidify your coding style[LIST=1]
[]PHP Basics
[
]Common PHP problems
[]PHP and mySQL coding tips
[/LIST]
[
]There is quite a bit of inline styling going on in there - that’s going to end up causing you some problems later on down the road, so I would suggest brushing up on css.
[/LIST]

Thank you very much. I will try