Welcome Guest, Not a member yet? Register   Sign In
Poll Query
#5

[eluser]wowdezign[/eluser]
This should get you one row from the database and return it.

Code:
function displayPoll(){
   $data=array();
   $this->db->order_by('poll.id', 'DESC');
   $this->db->join('options', 'poll.id = options.id_poll');
   $Q=$this->db->get('poll',1); // the 1 sets the limit to 1 record
  
   if($Q->num_rows() >0) {
       return $Q->row();
    }
}

If you want the possible answers, you could run another query using the id to get the answers.


Messages In This Thread
Poll Query - by El Forum - 11-08-2009, 10:40 PM
Poll Query - by El Forum - 11-08-2009, 10:47 PM
Poll Query - by El Forum - 11-08-2009, 10:50 PM
Poll Query - by El Forum - 11-08-2009, 10:59 PM
Poll Query - by El Forum - 11-08-2009, 11:05 PM
Poll Query - by El Forum - 11-09-2009, 06:00 PM
Poll Query - by El Forum - 11-09-2009, 10:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB