hey adrian,
the table names are right, and work great with scuffold. it works without scuffold too, i just want to make it more efficient. on some of the models i used hasmany, belongsto, and hasone. i get the table category and layout dumped, the problem is that i get all of the information from the fields => and not just category.name, or layout.name. there are a few ways to handle this. there are two ways I know: 1) do a mysql query 2) ask for specific fields in the hasone/belongsto/hasmany, .. i just wanna hear what else you guys are doing.. the cakephp way. :) yossi Adrian Godong wrote:
First you'll have to create correct associations for your Models (if you don't know how or too lazy to read the manual, ask again). Second, try dumping the whole thing you got from the Model->findAll or findBy... using debug($[modelname]->[functionname]); You'll see that accessing category.name and layout.name is just an array away from the main result. Still having problem? Print out to us the result of the steps above... On 12/26/06, phpjoy <[EMAIL PROTECTED]> wrote: > > > I have a controller, and I want to fetch information from tables. > With scaffold, it works wonderfully.. However I wanna load the > information smartly for my app. > > These are my tables: > section: > id > name > field1 > field2 > layout_id > category_id > > category: > id > name > field3 > field4 > field5 > field6 > > layout: > id > name > field7 > field8 > > I want to put the information from the section table in the view. > the category_id and layout_id should have category.name and layout.name > instead of the id of the category. > I could build a MySQL query for this, but I wonder what's the CakePHP > way. > (The more ways, the marrier it is ;)) > > > > > -- Adrian Godong [EMAIL PROTECTED] Microsoft Student Ambassador
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
