It turns out that I need to get random data from the database with the CodeIgniter
framework.
in database
I have a table called phrases and within it two fields:
Type and phrase
In the field type I have 1 which has 5 sentences and the same with type 2 type 3 type 4 type 5
Then I want to do a select phrases ramdon where type = 1
and to show me random phrases of type 1. Looking for I found this code:
function Getramdon(){
$this->db->order_by('tipo','RANDOM');
$this->db->limit(1);
$query = $this->db->get('frases');
return $query->result_array();
}
but it shows me aleatorial phrases of other types and not only of the 1 as I asked.