我試圖傳遞問題和第一個查詢中的問題的id,然後與該ID獲取該輪詢的選項並將其添加到數組。沒有看到我在這裏幹什麼。試圖添加到數組
下面是我收到的錯誤:
一個PHP錯誤遇到
嚴重性:注意
消息:未定義的屬性:CI_DB_mysql_result :: $行
文件名:型號/ sitemodel.php
行號:161遇到PHP錯誤
嚴重性:通知
消息:試圖讓非對象的屬性
文件名:型號/ sitemodel.php
行號:161
代碼:
function getPoll() {
$this->db->select('site_polls.id, site_polls_questions.poll_question');
$this->db->from('site_polls');
$this->db->join('site_polls_questions', 'site_polls_questions.id = site_polls.site_polls_questions_id');
$this->db->where('site_polls.status_id', 1);
$this->db->order_by('site_polls.date_posted', 'desc');
$this->db->limit(1);
$query = $this->db->get();
$id = $query->row->id;
$this->db->select('site_polls_questions_options.poll_option');
$this->db->from('site_polls_questions_options');
$this->db->where('id', $id);
$query = $this->db->get();
return $query->result_array();
}
我試圖找出如何我可以將投票問題添加到數組中。
是這裏的Joomla?我不太清楚'$ db'對象的作用,所以很難說出錯的地方。但是,您會收到通知,而不是錯誤,而且通常更多的是關於編碼標準等問題,而不是嚴重問題。另外,由於您的錯誤消息包含行號,因此在代碼中引用行號會很有幫助。 – julio
如果您發現我的代碼中有代碼點火器。 –
我明白了。現在。什麼是161線? – julio