Friday, April 30, 2010

Re: plz help me out

I was tried like this is correct or  not i dont know any one can help me out
$rsCDLog = pg_numrows($rsCDLog);


var $intCDLogCnt = $this->Tblcdlog->find(                  
         'count', array(
                        'conditions' => array(
                            'Tblcdlog.blnsuccess' => 1
                        ),
                        'fields' => array(
                            'Tblcdlog.dtmcreated'
                        )
                )
        );

On Fri, Apr 30, 2010 at 4:13 PM, Narendra Padala <crazycakephp@gmail.com> wrote:
$intProfileCnt = pg_numrows($rsProfile);


var $intCDLogCnt = $this->Tblcdlog->find(                  
         'count', array(
                        'conditions' => array(
                            'Tblcdlog.blnsuccess' => 1
                        ),
                        'fields' => array(
                            'Tblcdlog.dtmcreated'
                        )
                )
        );

I was tried like this is correct or  not i dont know any one can help me out


On Wed, Apr 28, 2010 at 3:54 PM, Jeremy Burns <jeremylp burns@me.com> wrote:
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


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 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

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 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


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 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: