*sigh*
On 1 okt, 14:31, Pieter Van Leuven <pieter.van.leu...@gmail.com>
wrote:
> OK. I built a small CakePHP application on ubuntu. It doesn't show
> relative data on my ubuntu install and online webhosting, but on my
> local windows installation the exact same code (with the exact same
> dababase) does! How is this possible? Am I missing something? I'm
> getting desperate ;-) It must be me doing something wrong, because the
> code is soo simple and obvious...
>
> Somebody to give me some more hints?
>
> The test-case:
> I built following small cakephp application (with 1.2.0.7296 RC2) on
> my ubuntu-installation. I am getting no relative data there and the
> query CakePHP builds looks like this: "SELECT `Post`.`id`,
> `Post`.`title`, `Post`.`content`, `Post`.`created`, `Post`.`modified`,
> `Post`.`user_id`, `Post`.`category_id` FROM `posts` AS `Post` WHERE 1
> = 1"
>
> On my windows installation, the complete same setup runs ok. There,
> CakePHP builds this query: "SELECT `Post`.`id`, `Post`.`title`,
> `Post`.`content`, `Post`.`created`, `Post`.`modified`,
> `Post`.`user_id`, `Post`.`category_id`, `User`.`id`,
> `User`.`username`, `User`.`password`, `User`.`emailaddress`,
> `User`.`created`, `User`.`last_login`, `User`.`active`,
> `User`.`is_admin`, `Category`.`id`, `Category`.`name` FROM `posts` AS
> `Post` LEFT JOIN `users` AS `User` ON (`Post`.`user_id` = `User`.`id`)
> LEFT JOIN `categories` AS `Category` ON (`Post`.`category_id` =
> `Category`.`id`) WHERE 1 = 1"
>
> The code:
>
> Model:
> <?php
> class Post extends Model {
> var $name = 'Post';
> var $belongsTo = array('User', 'Category');}
>
> ?>
>
> Controller:
> <?php
> class PostsController extends AppController {
> function index() {
> $this->set('posts', $this->Post->find('all'));
> }}
>
> ?>
>
> View:
> <h1>Posts</h1>
> <p>Overzicht van posts</p>
> <ul>
> <?php foreach ($posts as $post): ?>
> <li><?php echo $post['Post']['title']; ?> <small><?php echo
> $post['User']['username']; ?></small></li>
> <?php endforeach; ?>
> </ul>
>
> Thanks for any help in advance!
>
> Kind regards,
> Pieter Van Leuven
--~--~---------~--~----~------------~-------~--~----~
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