Hello, why not trying this:

if(!empty($data) && isset($data[0])) {
  echo "yay";
}
else {
  echo "No records found, we are really sorry :(";
}

if there are no records then $data should be empty and $data[0] should not
be set, that is how you check if there are any records, or I misunderstood
your question?

Have a nice day,
Faifas


On Wed, Feb 18, 2009 at 17:10, vikas <[email protected]> wrote:

>
> I have UsersController. In that I have a index() action.
>
> In that action, the code is:
>
> $data = $this->paginate('User');
> $this->set(compact('data'));
>
> Now I want to check that is there data available or not. Means if
> there is no record then I will get no record in array.
> But how to check this thing in view because I use $data variable in my
> index view.. So if there is no record then want to disply message that
> "no record found". but by default it display paginator string:
> Page 1 of 1, showing 0 records out of 0 total, starting on record 0,
> ending on 0
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to