tags:

views:

52

answers:

2

Hi , actually i have 1 query but i am unable to convert it into cakephp query format.

$result = "select * from esl_userresults,esl_lyrics where esl_userresults.esl_songID = esl_lyrics.id and esl_lyrics.song_name like '%".$esl_keyword."%'" ;

when i convert this query into cakephp it gives error like
esl_userresults.esl_songID unknown column.

Please help

thanks

A: 

You asked the same question yesterday: http://stackoverflow.com/questions/3092944/converting-simple-query-to-cake-query

Leo
Could you just point to the duplicate question and vote to close? Or do you not have enough rep yet? I'm not sure about the rules here.
Daren Thomas
http://stackoverflow.com/questions/3092944/converting-simple-query-to-cake-queryPlease remove the vote down. I didn't remove it because there is a new comment on it.
Leo
Leo :) done. Had to edit your answer, because SO otherwise locked my vote (is this a new feature? haven't been keeping up lately...)
Daren Thomas
A: 

You can execute any query using:

<?php 
   function some_controller_name()
   {
     $query_to_execute = 'SELECT * .....';
     $results = $this->ModelName->query($query_to_execute);
     $this->set('results', $results);
   }
?>

Hope this helps

Juanda
Just be careful with the SQL Injection!!!
Juanda