Currently I have a table called as 'Users'. With columns like
Id, name, image, is_active, etc, etc, created, modified
I am setting up a pagination, where it will display all Users one by one, on click of next button(in the view)
here not all Users will have images. So my pagination order will be: to show users who have images first. Followed by Users who don't have images.
So far I have this
$this->paginate = array(
'limit' => 1,
'conditions' => array(
'User.is_active' => 0
),
'order' => array(
'User.image' => 'DESC'
),
'group' => array(
'User.id'
)
);
What I want is now, the view to FIRST display a random User, who has image, every time the page refreshes OR on the first load of the page. Followed by other Users who have images ,and then followed by Users who don't have images.
this query works fine in phpmyadmin sql panel. But I am not sure how do I write a cakephp paginate query for it
select * User order by image<>' ' desc,rand()
If you think I am missing any more data, please ask. I'll write it in comments