Sunday, June 1, 2014

Re: Custom queries in cake PHP

Nikhil, I was wondering where using the below code:
         $output = $this->ModelName->query('SELECT Example FROM USER')
Isn't this vulnerable to sql injection? How to prevent this???

On Sunday, August 12, 2012 2:01:47 AM UTC-4, Nikhil Agrawal wrote:
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 <araf...@gmail.com> 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 <mohi...@gmail.com> 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

+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
cake-php+u...@googlegroups.com 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 cake...@googlegroups.com.
To unsubscribe from this group, send email to cake-php+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: