Almost...
You need to run finds/counts against the model that is related to your table.
For your table tblmusicprofiles your model will be Tblmusicprofile (singular,
camel cased).
So, for example, your find statement would be something like this:
$rsProfile = $this->Tblmusicprofile->find(
'all',
array(
'conditions' => array(
'Tblmusicprofile.lngprofile' => '$PROFILE_ID'
),
'fields' => array(
'Tblmusicprofile.strprofilename'
)
)
);
I would also recommend looking up the Containable behaviour
(http://book.cakephp.org/view/1323/Containable).
Your table naming convention is not ideal. I'd point you towards
http://book.cakephp.org/view/903/Model-and-Database-Conventions for more
details.
Jeremy Burns
[email protected]
On 28 Apr 2010, at 11:13, chandrasekhar reddy wrote:
> I am new for cakephp plz help me out . below statements are correct or wrong
> . idontknow
>
>
> While converting this sql query into cakephp for result set and count
>
> 1. Result set
>
> $rsProfile = pg_exec($conn,"SELECT strprofilename FROM tblmusicprofiles WHERE
> lngprofile = $PROFILE_ID");
>
>
>
> var $rsProfile = $this->tblmusicprofiles->find('all', array('conditions' =>
> array('tblmusicprofiles.lngprofile' => '$PROFILE_ID'),
> 'fields' => array('tblmusicprofiles.strprofilename')));
>
>
>
>
> 2. count
>
> $intProfileCnt = pg_numrows($rsProfile);
>
>
> var $intProfileCnt = $this->tblmusicprofiles->find('count',
> array('conditions' => array('tblmusicprofiles.lngprofile' => '$PROFILE_ID'),
> 'fields' => array('tblmusicprofiles.strprofilename')));
>
>
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" 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
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" 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