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

[eluser]WhitecastlePT[/eluser]
Hello, here's an example with active records: Works like a charm Wink

Code:
function getAllFotos()
    {
       $data = array();
       $this->db->select();
       $this->db->from('foto_tbl');  
       $this->db->where('isthumb',1);     /* <-- You can remove this */          
       $query = $this->db->get();            
       if($query->num_rows() > 0)
           {
               foreach ($query->result() as $row)
                {
                    $data[] = $row;                    
                }
                srand((float)microtime()*1000000); /* example from suffle function in PHP manual, values can be altered!*/
                shuffle($data);
                return $data;
           }
    }


Messages In This Thread
Random Query - by El Forum - 12-10-2009, 12:06 PM
Random Query - by El Forum - 12-10-2009, 12:15 PM
Random Query - by El Forum - 12-10-2009, 04:02 PM
Random Query - by El Forum - 12-10-2009, 04:40 PM
Random Query - by El Forum - 08-27-2012, 05:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB