Ok, I did some research and discovered the following:
On my local system I have a query like this: (as seen in the query
overview delivered by CakePHP when running in debugmode 2)
"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 ORDER BY `Post`.`created` desc LIMIT 10"
On the online webserver, the exact same query 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 ORDER BY
`Post`.`created` desc LIMIT 10"
This problem occurs even when I deleted the cache. Somebody an idea
how this is possible? Why would CakePHP decide to not fetch relative
data? Is there a way to eventually force this?
Below I posted the code, but I think nothing is wrong with that. It's
as simple as it can be.
Code in 'post' model:
// Relaties
var $belongsTo = array('User','Category');
var $hasMany = array(
'Comment' => array(
'className' => 'Comment',#
'foreignKey' => 'node_id',
'conditions' => 'contenttype_id = 1',
'order' => 'Comment.created DESC'
)
);
Code in 'posts' controller:
$posts = $this->paginate('Post');
$this->set(compact('posts'));
Example code from view:
<?php echo $html->link($post['User']['username'], '/
users/view/'.$post['User']['username']); ?> als <?php echo $html-
>link($post['Category']['name'], '/categories/view/'.$post['Category']
['id']); ?>
On 30 sep, 12:37, Pieter Van Leuven <[EMAIL PROTECTED]>
wrote:
> Ah I see. I switched the error reporting value for my local PHP to
> E_ALL, but I'm getting no errors at all. It has indeed to be
> difference in configuration between my local machine and the online
> server, but I have absolutely what it could be.
>
> Is the fact that I didn't build the models with the bake command
> relevant? I build them myself. It's my first project with CakePHP. If
> you want, to take a look, the project can be found
> here:http://kljichtegem.be/beta/.
>
> Kind regards.
>
> On 30 sep, 11:58, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>
> > No, I mean the PHP error reporting in your
> > php.ini.http://jp2.php.net/manual/en/configuration.phphttp://jp2.php.net/manu......
>
> > The error is coming from PHP, not Cake.
> > You should switch error reporting on on your development system and
> > off on your production system. If the error reporting is on on your
> > development system and it's not giving you any errors (i.e. no
> > programming mistakes) it'll be something that's set up differently on
> > your production machine.
>
> > On 30 Sep 2008, at 18:48, Pieter Van Leuven wrote:
>
> > > Hello David,
>
> > > thanks for the tips. Both are currently running in debuglevel 2 mode.
> > > That's why I think it's so strange.
>
> > > Can someone give me some tips about what could be wrong with the
> > > database? The application can reach the database, because some data is
> > > fetched correctly...
>
> > > Thanks in advance,
> > > Pieter Van Leuven
>
> > > On 30 sep, 07:37, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> > >> Stabs into the dark:
>
> > >> a) your local PHP has a lower debug level than your production
> > >> server,
> > >> i.e. your local system doesn't complain about missing indexes but
> > >> your
> > >> server does
> > >> b) the associated model can't be fetched because your database setup
> > >> is different/misconfigured
>
> > >> Hope that helps,
> > >> Dav
>
> > >> On 30 Sep 2008, at 06:26, Pieter Van Leuven wrote:
>
> > >>> Hello people,
>
> > >>> I have a strange problem i ran into with CakePHP. On my local
> > >>> machine
> > >>> all works fine. When I upload the complete project to my webhost,
> > >>> the
> > >>> problems begin.
>
> > >>> For example: when I query posts from the database. All fields of
> > >>> this
> > >>> posts are shown fine (for example $post['Post']['title'], but all
> > >>> relative data like for example the username ($post['User']
> > >>> ['username']) gives an error similar to 'Notice (8): Undefined
> > >>> index:'. Someone an idea what the problem could be?
>
> > >>> Could this be a know problem? I tried to search, but it is difficult
> > >>> with that less information.
>
> > >>> Some things I already thought of:
> > >>> - Version difference of apache/mysql from my local machine/webhost
> > >>> server
> > >>> - windows newlines on my local machine versus webhost server (not
> > >>> tested yet)
>
> > >>> Local server:
> > >>> - Apache/2.2.9 (Win32)
> > >>> - mysql/5.0.51b with phpMyAdmin/5.0.51b
> > >>> - vista
>
> > >>> Webhost server:
> > >>> - Apache/2.2.3
> > >>> - mysql/5.0.32-Debian_7etch6-log with phpMyAdmin/5.0.32
> > >>> - debian
>
> > >>> Already thanks for reading this folks!
>
> > >>> 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 [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
-~----------~----~----~----~------~----~------~--~---