我想在函數中編譯一個mysqli變量的if語句,但我收到一個致命錯誤,聲明'使用$ this,而不是在對象上下文中...在行117上。我做錯了,我怎麼能得到的if語句在函數中工作?
代碼:
$qandaquery = "SELECT ReplyType
FROM Reply";
$qandaqrystmt=$mysqli->prepare($qandaquery);
// get result and assign variables (prefix with db)
$qandaqrystmt->execute();
$qandaqrystmt->bind_result($qandaReplyType);
$this->shared_result[] = $qandaReplyType; //ERROR HERE
function ExpandOptionType($option) {
if('Single' == $this->shared_result){
...
}else if('Multiple' == $this->shared_result){
...
}
}
你想''這個''在這裏意味着什麼開始? – deceze 2013-02-13 10:57:32
你在這個領域沒有課,所以$這不起作用。 shared_result數組的初始化在哪裏?你可以請張貼這個片段嗎? – Shimu 2013-02-13 10:58:01
我想你不是在課堂上工作,查看功能 – 2013-02-13 11:00:07