i have comments function,i have field in comments table that called
"status" i want to check this specific field value if it is equal to 0
or not...i want to know how to check  field value in the contoller..i
write wrong code..someone help me please to correct this code

   function admin_publish ($id = null){
                  if (!$id) {
                        // set flash message
                        $this->Session->setFlash('Invalid id for 
Location','default',
array('class' => 'flash_bad'));
                        // redirect
                        $this->redirect(array('action'=>'admin_index'));
                }else{
               // if comment status field 0
        if($comments['Comment']['status']== null){
                // change status from 0 to 1
             $this->Comment->saveField('status',1);
                        // set flash message
                        $this->Session->setFlash('The Comment was successfully
Published.');
                } else {
                     $this->Comment->saveField('status', 0);
                        // set flash message
                        $this->Session->setFlash('The Comment could not be 
NotPublished.');
                }

                // redirect
                $this->redirect(array('action'=>'admin_index'));
        }
        }

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to