大家好我現在剛剛開始用PHP,即時通訊目前試圖產生一個字符串出來放在HTML頁面,但沒有多少運氣,目前這是我迄今爲止做的。無法輸出字符串變量從SQL結果通知
$qry = "INSERT INTO bids VALUES (NULL,'".$_SESSION['userID']."','$productID', '".$_POST['bids']."', NOW() )";
$rs = $this -> db -> query($qry);
if($rs)
{
//this bit checks if the database have been added or not by the value greater than 0 then we know it was successful
if($this -> db -> affected_rows > 0)
{
$msg = 'Your bid has been placed';
}
else
{
$msg = 'error in inputing the bid';
}
}
else
{
$msg = 'Outside of $rs';
}
return $msg;
}
帶字符串$ msg im希望能夠把它作爲html頁面上的字符串輸出。 $html . = '$msg';
但目前它沒有出現任何人都可以讓我知道我做錯了什麼?爲什麼$msg
不會顯示?
在你的實際代碼中'$ this - > db - > query($ qry)'和'$ this - > db - > affected_rows'中的空格是什麼? –
你如何輸出$ html? – redbirdo
顯示調用此函數的代碼,問題就在那裏。 – Barmar