[eluser]benfike[/eluser]
Its ok! Thank you!
But how can I get the voteid of last(date desc) poll from db for $voteid?
I try with this: $vote_id = $this->Mpoll->getPolls($poll['voteid']);
[code]function getPolls(){
$data = array();
$this->db->where('status','active');
$this->db->orderby('date','desc');
$this->db->limit(1);
$Q = $this->db->get('votes_question');
if($Q->num_rows() > 0){
$row = $Q->row_array();
$data['voteid'] = $row['voteid'];
$data['question'] = $row['question'];
$data['status'] = $row['status'];
$data['date'] = $row['date'];
}
$Q->free_result();
return $data;
}[code]
But i get this:
A Database Error Occurred
Error Number: 1054
Unknown column 'Array' in 'where clause'
SELECT COUNT(*) AS `numrows` FROM (`votes_votes`) WHERE `voteid` = Array AND `userid` = '2'