Fatal error: Call to a member function execute() on a non-object in ............/framework/Framework.php on line 551
|
1 posts
|
Localy everything works great (PHP Version 5.2.3-1ubuntu6) however on my production (PHP Version 5.1.6) machine I get: Fatal error: Call to a member function execute() on a non-object in ............/framework/Framework.php on line 551 It relates to: $stmt = self::$CONN->prepare($sql); $stmt->execute($values); As a matter of fact, some querries were properly executed. No idea why because, PDO is compiled in. PLEASE HELP Pete |
|
541 posts
|
I need more informations! Where did you get this error (administration or public site), which page, in snippet section, in the page list, page edit, layout ... What version of Frog CMS do you use ? do you use PDO or you use ... all informations you can give will help to answer your problem. |
|
5 posts
|
Actualy this has nothing to do with the CMS, which is great by the way and we use it as well. I am getting this error in the framework.php which we are employing in a current project. This has something to do with the Record class. Every controller methods that queries the database throws such message out and finishes without displaying view. What is interesting is that some queries go through and actualy are recorded in the database. We never devoted that much time into figuring out how exactly the framework works, but know that we have to heres a question: in config.php we create a new global variable $PDO_CONN index.php is calling Record::connection($PDO_CONN) now every signle method of the Record class is static. I dont see anywhere in the code a declaration $r = new Record() $r->PDO_CONN = $PDO_CONN or alternatively $r->savePdo($PDO_CONN); My knowledge of PHP is limited so maybe im wrong but how is it possible that calling Record::connection() preserves the state of the self::PDO_CONN in methods which are called later from uninstantioated class(called staticaly) Cheers, Pete |
|
541 posts
|
Ho ok .. this is your sql query that is wrong ... the framework execute your query that's it !! , so the problem is not in the framework. |
|
541 posts
|
maybe I can add some tracking error there !!, but for now the framework doesn't track error |
|
5 posts
|
do you have any idea of what could be going wrong, or perhaps an idea for a quick fix? Id appreciate that. i spent last two weeks working on a something that which works perfectly on my local machine, and I absolutely need it in production by tomorrow :) |
|
56 posts
|
Try running your query by hand as the same DB user you are having the Framework run it as. Also, ensure that the query you think you're running is indeed the same as the one you actually are executing. (For example, you may have a quoting issue in your "live" query, but not your "test" query.) |
|
5 posts
|
Alright now im sure this is PDO driver and mysql version related issue. Nothing todo with framework |
|
5 posts
|
More news, i think this has to do with $stmt->fetch and lack of the $stmt->closeCursor() Heres an explanation of the problem http://www.inovaone.com/blog/?p=25 Ill post a solution if i get it working |
|
541 posts
|
Ho maybe I have something for you then .... try to set this after creating your pdo connection write:
and thanks for the closeCursor(), I will look at this more in details |
|
5 posts
|
Thanks that was one of the first things i tried, but it did not help. Anyhow I resolved the whole issue and Im still not sure were the problem was - but it has to do with the particular server setup. By the way your framework ROCKS. Thanks!!! Pete |
|
541 posts
|
I think if you can use it without any documentation this is a good thing !! :) if you have any problem or suggestion, we will do hour best ! |
|
1 posts
|
I get a similar problem: Fatal error: Call to a member function execute() on a non-object in /var/www/comercial/frog/app/backend/models/Page.php on line 222 So I go to line 222 and see this:
So the problem should be before that, so I insert a print() for the $sql:
Then I check the output and try that SQL directly in mysql (from command line):
so I rename “Page” to “page” that is a real table in the DB:
The problem was in the SQL syntax so no
We can remark the non-object think here. |
|
1 posts
|
as someone whos non technical (i dont know php) is there a quick file overwrite i can do to fix this and if so does anyone have a file i can use :) many thanks |