Hi,
        i am getting this error while calling the function

my db table
------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `cats` (
  `cat_id` int(11) NOT NULL AUTO_INCREMENT,
  `cat_name` varchar(150) NOT NULL,
  PRIMARY KEY (`cat_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `cats`
--

INSERT INTO `cats` (`cat_id`, `cat_name`) VALUES
(1, 'foo'),
(2, 'arr');
-------------------------------------------------------------------------------
MyController:(cats_controller.php)
----------------------------------------------------------------------------------------------------------------
<?php
class CatsController extends AppController {

        var $name = 'Cats';
    var $helpers = array('Html', 'Javascript', 'Ajax');

        function index() {
                 $this->set('cats', $this->Cat->find('all'));
        }

        function view($id = null) {

                $this->Cat->cat_id = $id;
                $this->set('cats', $this->Cat->read());
        }
        function catfun($id = null) {
            $this->set('cats', $this->Cat->find('all'));
                $this->Cat->cat_id = $id;
                $this->set('cats', $this->Cat->read());
        }
}

?>
--------------------------------------------------------------------------------------------------------------
MyModel:(cat.php)
-------------------------------------------------------------------------
<?php

class Cat extends AppModel {
    var $name = 'Cat';

}

?>
-------------------------------------------------------------
in views:(catfun.ctp)
---------------------------------------------------
/app/views/cats/cat.ctp

<h1>Blog posts</h1>
<p><?php echo $html->link('Add Cat', array('action' => 'add')); ?></p>
<table>
        <tr>
                <th>Id</th>
                <th>Name</th>
        </tr>

<!-- Here's where we loop through our $posts array, printing out cat
info -->

        <?php foreach ($cats as $cat): ?>
        <tr>
                <td><?php echo $cat['Cat']['cat_id']; ?></td>
                <td>
                <?php echo $html->link($cat['Cat']['cat_name'], array('action' 
=>
'view', 'id' => $cat['Cat']['cat_id']));?>
                </td>
                <td>
                <?php echo $html->link('Delete', array('action' => 'delete', 
'id' =>
$cat['Cat']['id']), null, 'Are you sure?' )?>
            <?php echo $html->link('Edit', array('action'=>'edit', 'id'=>$cat
['Cat']['id']));?>
                </td>
                <td><?php echo $cat['Cat']['created']; ?></td>
        </tr>
        <?php endforeach; ?>

</table>
---------------------------------------------------------------------------------------------------
(index.ctp)
---------------------------------------------------------------------------------------
app/views/cats/index.ctp
<h1>BookStore</h1>
<tr>
<td><?php echo $html->link('category', array('action' => 'catfun')); ?
></td>
<td><?php echo $html->link('Publisher', array('action' => 'add')); ?></
td>
<td><?php echo $html->link('Author', array('action' => 'add')); ?></
td>
<td><?php echo $html->link('Edition', array('action' => 'add')); ?></
td>
<td><?php echo $html->link('ISBN', array('action' => 'add')); ?></td>
</tr>
-------------------------------------------------------------------------------------------------------
view.ctp
-----------------------------------------------------------------------------------------
<!-- File: /app/views/cats/view.ctp -->

<h1><?php echo $cat['Cat']['cat_name']?></h1>
----------------------------------------------------------------------


          please help it's very urjent

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

Reply via email to