I think you can use
find('first', $params) function to retrieve your data.
Please see the link http://book.cakephp.org/view/449/find . It covers diffrent ways of using the find function.
Hope this may help you.
- Haripriya
On Thu, Jun 25, 2009 at 8:41 AM, David <david@reflashed.com> wrote:
Hello,
I was curious as to what's the best way is to find a row's id based
off another field's value.
example:
function sortByGenre($genre_name) {
$genre = $this->Game->Genre->find('all', array('conditions'=>array
('value'=>$category_name)));
$genre_id = $genre[0]['Genre']['value'];
}
...Now I know there's got to be a better way. Does cakePHP have any
convenience functions or any other way to make this simpler? I have a
feeling I'm approaching this in the completely wrong way.
David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment