當我從網絡瀏覽器訪問它時,它只會返回echo'd文本,我知道這與我發佈的另一個問題類似,但我無法理解它?Web瀏覽器沒有任何返回 - 函數錯誤?
<?php
include('config.php');
include('database.php');
class conversion{
public $amnt;
public $cc_from;
public $cc_to;
public function __construct(){
$this->amnt = htmlspecialchars($_GET["amnt"]);
$this->cc_from = htmlspecialchars($_GET["from"]);
$this->cc_to = htmlspecialchars($_GET["to"]);
}
function convert($this->amnt,$this->cc_from,$this-cc_to,$decimals=2){
$db_rate_from = mysql_query("SELECT * FROM _currency WHERE country_code='$this- >cc_from'") or die(mysql_error());;
$query_row_from = mysql_fetch_array($db_rate_from);
$rate_from = ($query_row_from['rate']);
echo $rate_from;
echo "</br>rate to</br>";
$db_rate_to = mysql_query("SELECT * FROM _currency WHERE country_code='$this->cc_to'") or die(mysql_error());;
$query_row_to = mysql_fetch_array($db_rate_to);
$rate_to = ($query_row_to['rate']);
echo $rate_to;
echo "</br>conversion</>";
$conversion = (number_format(($amnt/$rate_from)*$rate_to,$decimals));
echo $conversion;
} }
$var = new conversion();
$var->convert($amnt,$cc_from,$cc_to);
?>
好的SQL注入漏洞。使用htmlspecialchars來「安全」SQL數據就像使用衛生紙廣場清理海洋。 – 2012-02-22 14:55:00
縮進你的代碼可以提供幫助,僅僅在FYI之後。 – Ryan 2012-02-22 14:55:15
您的預期產出是多少?您的實際產出是多少? – 2012-02-22 14:55:52