我在從SQL查詢中返回php中的數據時遇到了問題。這裏是我的代碼:在php中返回sql數組
public function get_audit_message($productId,$accountId)
{
$sql_list ="SELECT notes
FROM ".$this->tables_audit."
WHERE productId = '".mysql_real_escape_string($productId)."'
AND accountId = '".mysql_real_escape_string($accountId)."'
";
$query = $this->db->query($sql_list);
if($query->num_rows() > 0)
{
$return = $query->result_array();
return $return;
}
else return false;
}
我有麻煩的原因是因爲它是在返回結果的正確數目,但只顯示單詞「陣列」。那麼如果我將其更改爲return $return[0];
,則會正確返回第一個輸入的信息。
所以我想要做的是選擇所有陣列號碼,例如return $return[*];
,如果只有可能的話。
任何建議將不勝感激。