Quantcast

Custom queries in cake PHP

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Custom queries in cake PHP

mohit kumar
Hi Folks,
What is the best way to have custom queries from the database. I need to query from one of the pages.

With Best Regards,
Mohit Kumar

+91-9582894570

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Custom queries in cake PHP

Vinicius Dusso
Hi Mohit,

You can use the 'query' method:

$this->YourModel->query('SELECT * FROM table');

Take a look in this tutorial:

[]'s

Vinicius

Em segunda-feira, 6 de agosto de 2012 13h06min53s UTC-3, mohit escreveu:
Hi Folks,
What is the best way to have custom queries from the database. I need to query from one of the pages.

With Best Regards,
Mohit Kumar

+91-9582894570

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Custom queries in cake PHP

mohit kumar
How to use them in view template?


With Best Regards,
Mohit Kumar

+91-9582894570



On Mon, Aug 6, 2012 at 10:43 PM, Vinicius Dusso <[hidden email]> wrote:
Hi Mohit,

You can use the 'query' method:

$this->YourModel->query('SELECT * FROM table');

Take a look in this tutorial:

[]'s

Vinicius

Em segunda-feira, 6 de agosto de 2012 13h06min53s UTC-3, mohit escreveu:
Hi Folks,
What is the best way to have custom queries from the database. I need to query from one of the pages.

With Best Regards,
Mohit Kumar

+91-9582894570

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Custom queries in cake PHP

lowpass
You don't. That should be in the model. From the view, you should look
into requestAction() to call a method in your controller. But before
you do that you should consider putting the logic in the controller to
begin with, and not in the view.

On Mon, Aug 6, 2012 at 1:29 PM, mohit kumar <[hidden email]> wrote:

> How to use them in view template?
>
>
> With Best Regards,
> Mohit Kumar
> +91-9582894570
>
>
>
> On Mon, Aug 6, 2012 at 10:43 PM, Vinicius Dusso <[hidden email]> wrote:
>>
>> Hi Mohit,
>>
>> You can use the 'query' method:
>>
>> $this->YourModel->query('SELECT * FROM table');
>>
>> Take a look in this tutorial:
>> http://book.cakephp.org/1.3/view/1027/query
>>
>> []'s
>>
>> Vinicius
>>
>> Em segunda-feira, 6 de agosto de 2012 13h06min53s UTC-3, mohit escreveu:
>>>
>>> Hi Folks,
>>> What is the best way to have custom queries from the database. I need to
>>> query from one of the pages.
>>>
>>> With Best Regards,
>>> Mohit Kumar
>>> +91-9582894570
>>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> [hidden email] For more options, visit this group
>> at http://groups.google.com/group/cake-php
>
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [hidden email] For more options, visit this group at
> http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Custom queries in cake PHP

Yasir Arafat Hasib
In reply to this post by mohit kumar
Hello follow the url

http://arafats.info/cakephp-custom-query/

Is that ok for you?
Thanks

On Mon, Aug 6, 2012 at 10:06 PM, mohit kumar <[hidden email]> wrote:
Hi Folks,
What is the best way to have custom queries from the database. I need to query from one of the pages.

With Best Regards,
Mohit Kumar

<a href="tel:%2B91-9582894570" value="+919582894570" target="_blank">+91-9582894570

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php



--
Thanks & Regards.
-----------------------------------------------------------------------------------------------------------------------------
Yasir Arafat (Hasib)
Deputy Project Manager, Software Solutions
Grameen Solutions
Contact Information:
Cell : +8801816 536 901, +880197 333 2 888
Web: http://arafats.info

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Custom queries in cake PHP

Nikhil Agrawal
Hey mohit,

As a better practice never use queries in controller or view files. Always use a model for all your db queries .
Although you can use queries in both controller and models, i think it can't be used in view files.

From controller:
$output = $this->ModelName->query('SELECT Example FROM USER')
From Model:
$output = $this->query('SELECT Example FROM USER')

If any one has solution to use it in view file, pls share it.
Thanks

On Sun, Aug 12, 2012 at 10:23 AM, Yasir Arafat Hasib <[hidden email]> wrote:
Hello follow the url

http://arafats.info/cakephp-custom-query/

Is that ok for you?
Thanks

On Mon, Aug 6, 2012 at 10:06 PM, mohit kumar <[hidden email]> wrote:
Hi Folks,
What is the best way to have custom queries from the databa se. I need to query from one of the pages.

With Best Regards,
Mohit Kumar

<a href="tel:%2B91-9582894570" value="+919582894570" target="_blank">+91-9582894570

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php



--
Thanks & Regards.
-----------------------------------------------------------------------------------------------------------------------------
Yasir Arafat (Hasib)
Deputy Project Manager, Software Solutions
Grameen Solutions
Contact Information:
Cell : +8801816 536 901, +880197 333 2 888
Web: http://arafats.info

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

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 
Loading...