0
Hello everyone from Codeigniter Brasil, I have a query that returns everything perfect in localhost but the server does not return the way it was written.
It is to return 6 results but on the server returns the amount he finds best up to 6.
$this->db->limit(6);
$this->db->select("*");
$this->db->from("vips");
$this->db->join("anuncios", "anuncios.id = vips.idPostVip");
$this->db->order_by('RAND()');
return $this->db->get()->result_array();
Any hint ?
Some configuration of PHP ?
Help me Rs.
Thank you.
what is the expected result with this code, how many records should return?
– novic
Should return 3 results.
– Bruno Luiz
Then the limit it is respecting if behind 1, 2 or 3. It should be this vip Where > 0. Check the data. Should not be attending the Where.
– user26552
Hello, so the server has many Vips posts, it pulls only Vips but does not bring back the 3 I need. This is what I’m not getting.
– Bruno Luiz
I would put the limit line after the order_by, but I don’t know if that’s the problem.
– user26552
@Brunoluiz already tried to pull the line
$this->db->where("vip > ",0);
to see if it works?– novic
I’ve taken and remains the same.
– Bruno Luiz
Poxa then needs to see the whole process to be sure of what is happening ... even complicated
– novic
What makes me not understand is that I only have the model, I pull the Controller and I show it in the View, there’s nothing else. Do you have another way to do Random without order by ?
– Bruno Luiz
Yes, there is! .... ....
– novic
This post was not answered here and was not answered here. They keep putting that my post was solved here but it was not, the answers were wrong and I continue with the problem.
– Bruno Luiz
When you run this query directly in the database (via phpmyadmin) of the production server comes 6 records?
– rray