What is the debug level? Set it to 2 if not and then look at SQL query

2009/2/7 abhishek <[email protected]>

>
> I am writing a simple TASK application: with 1 model, 1 controller,and
> 2 views.
> In the application, you can add a task and it shows a list of all the
> tasks.
>
> my problem is I am not getting the output shown in the index view.
> Database is being updated fine, which means it is working I don't know
> why the data is not showing in the index view.
>
> Thanks a lot.
>
> My database:
> CREATE TABLE tasks(
>        id int(10) unsigned NOT NULL auto_increment,
>        title varchar(255) NOT NULL,
>        done tinyint(1) default NULL,
>        created datetime default NULL,
>        modified datetime default NULL,
>        PRIMARY KEY (id)
> );
>
> MODEL
> <?php
> class Task extends AppModel{
>        var $name = 'Task';
> }
> ?>
>
>
> THE CONTROLLER
> <?php
> class TasksController extends AppController{
>
>        var $name = 'Tasks';
>        var $helpers = array('Html', 'Form');
>        function index(){
>                $this->set('tasks', $this->Task->find('all'));
>
>        }
>
>    function add(){
>        if (!empty($this->data)){
>            $this->Task->create();
>            if ($this->Task->save($this->data)){
>                $this->Session->setFlash('Task has been saved');
>                $this->redirect(array('action'=>'index'),null, true);
>
>            }else{
>                $this->Session->setFlash('Task not saved. Try
> again.');
>            }
>        }
>
>    }
> }
> ?>
>
> VIEW INDEX
>
> <h2>TASKS</h2>
> <?php if(empty($tasks)): ?>
>        There are no tasks in this list
> <?php else: ?>
>
>        <table>
>                <tr>
>                        <th>Title</th>
>                        <th>Status</th>
>                        <th>Created</th>
>                        <th>Modified</th>
>                        <th>Actions</th>
>                </tr>
>
>                <?php foreach($tasks as $task): ?>
>                        <tr>
>                                <td>
>                                        <?php $task['Task']['title'] ?>
>                                </td>
>
>                                <td>
>                                        <?php if($task['Task']['done']) echo
> "Done";
>                                                else echo "Pending";
>                                        ?>
>                                </td>
>                                <td>
>                                        <?php $task['Task']['created'] ?>
>                                </td>
>                                <td>
>                                        <?php $task['Task']['modified'] ?>
>                                </td>
>                                <td>
>
>                                </td>
>                        </tr>
>                <?php endforeach; ?>
>        </table>
>
>
> <?php endif; ?>
> <?php echo $html->link('Add Task', array('action'=>'add')); ?>
>
>
> VIEW ADD:
> <?php echo $form->create('Task'); ?>
>
> <fieldset>
>
>    <legend>
>        Add New Task
>    </legend>
>    <?php
>        echo $form->input('title');
>        echo $form->input('done');
>    ?>
> </fieldset>
> <?php echo $form->end('Add Task');?>
>
> <?php echo $html->link('List All Task', array('action'=>'index')); ?>
>
>
>
> my problem is I am not getting the output shown in the index view.
> Database is being updated. But it doesn't show in the view.
>
> >
>


-- 
Amit

http://amitrb.wordpress.com/
http://coppermine-gallery.net/
http://cheesecake-photoblog.org/
http://www.sanisoft.com/blog/author/amitbadkas

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