Re: Few errors I found so far.

2008-10-28 Thread [EMAIL PROTECTED]

Thank you Gabriel, I am currently using the Beginning CakePHP book as
my tutorial to Cake and some of the code in the book and the source I
downloaded, does not work.

Hence all the questions, thank you so much once again.

Martin


On Oct 27, 3:53 pm, Gabriel Gilini [EMAIL PROTECTED] wrote:
 Try to set 'model' = 'comments' in the options array.
 Sorry, I meant 'model' = 'Comment'.

 Gabriel Gilini

 www.usosim.com.br
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]

 On Mon, Oct 27, 2008 at 12:50 PM, Gabriel Gilini [EMAIL PROTECTED]wrote:

  On Mon, Oct 27, 2008 at 11:36 AM, [EMAIL PROTECTED] 
  [EMAIL PROTECTED] 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

  Cheers,

  Gabriel Gilini

 www.usosim.com.br
  [EMAIL PROTECTED]
  [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Few errors I found so far.

2008-10-27 Thread Gabriel Gilini
On Mon, Oct 27, 2008 at 11:36 AM, [EMAIL PROTECTED] [EMAIL PROTECTED]
 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

 

Cheers,

Gabriel Gilini

www.usosim.com.br
[EMAIL PROTECTED]
[EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Few errors I found so far.

2008-10-27 Thread Gabriel Gilini
Try to set 'model' = 'comments' in the options array.
Sorry, I meant 'model' = 'Comment'.

Gabriel Gilini

www.usosim.com.br
[EMAIL PROTECTED]
[EMAIL PROTECTED]


On Mon, Oct 27, 2008 at 12:50 PM, Gabriel Gilini [EMAIL PROTECTED]wrote:

 On Mon, Oct 27, 2008 at 11:36 AM, [EMAIL PROTECTED] 
 [EMAIL PROTECTED] 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

 

 Cheers,

 Gabriel Gilini

 www.usosim.com.br
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---