this will help me but it is not returning value it is returning only
Array as value please help me how to solve this porblem
---see this --
Counter : Array
function index(){
$count = $this->Entry->find('all', array('fields' => array('(max
(Entry.cou
$count = $this->Entry->find('all', array('fields' => array('(max
(Entries.counter)) as max_counter'));
Will return an array with the max_counter value in it.
On Jan 8, 8:29 am, mona wrote:
> I know how to handle queries but i don't know how to fetch values of
> variables for example
> i wan't t
I know how to handle queries but i don't know how to fetch values of
variables for example
i wan't to fetch max(counter) so i know how to write query but how to
store value of this in some variable and print them in my index view
for eg
$query=mysql_query("select max(counter) from entries");
I'm not sure I understand your question, but if you have a field you
want to save a counter in, you can do this in the model using
countCache: http://book.cakephp.org/view/445/cacheQueries
If on the other hand you need to find the count from some set of
values, you can simply use find('count'):
You can use Model->query('any sql statement') to execute arbitrary sql
code. Bear in mind, however, that what you're trying to do can be done
with cake's built in methods in a much cleaner way. Model->query()
should really be used as a last resort when cake can't handle what
you're trying to
How to do what in CakePHP?
Thomas
On Jan 8, 7:46 am, mona wrote:
> I have code of my controller in which i use normal php codes to fetch
> data from a database and update counter how to do this in cakephp
>
> class EntriesController extends AppController
> {
> var $name = 'Entries';
>