On Mon, Oct 27, 2008 at 11:36 AM, schuchster@gmail.com <schuchster@gmail.com> wrote:
hi all,
Hi.
Just a few errors I found so far, if anyone can help, it would be much
appreciated.
1. Having multiple conditions on find:
post.php Model
$this->find('all', array('conditions' => array('DATE(Post.date)' => '>
'.$date, 'Date(Post.date)' => '< '.$end_date)));
SQL generated:
SELECT `Post`.`id`, `Post`.`name`, `Post`.`date`, `Post`.`content`,
`Post`.`user_id`, `User`.`id`, `User`.`name`, `User`.`email`,
`User`.`firstname`, `User`.`lastname` FROM `posts` AS `Post` LEFT JOIN
`users` AS `User` ON (`Post`.`user_id` = `User`.`id`) WHERE
DATE(`Post`.`date`) = '> 2008-01-01 00:00:00' AND Date(`Post`.`date`)
= '< 2008-12-31 23:59:59'
Results:
None, but I know there are 2 results.
That's because the < and > signs should be in the array key, not value. Try changing your conditions to something like this
array(
'conditions' => array(
'DATE(Post.date) >' => $date,
'DATE(Post.date) >' => $end_date
)
)
2. Htaccess issue?
view.ctp for posts:
<?=$ajax->form('/comments/add', 'post', array('update'=>'comments')); ?
>
Code generated for the form:
action="/workspace/cake/posts/comments/add"
Results:
Should this not be:
action="/workspace/cake/comments/add" ?
Try to set 'model' => 'comments' in the options array.
Kind Regards,
Martin
gabriel@souagil.com.br
--~--~---------~--~----~------------~-------~--~----~
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:
Post a Comment