recently upgraded our server 5.4 , started getting following error
non-static method db::connect() should not called statically i've researched & down, , every solution presented has not worked. have tried turning off strict error reporting @ file level, directory level, , server level. actual error appearing in browser is:
db error: connect failed module: /path/to/login_class.php line: 49 edit: posting full code lib_app.php:
<?php /*-------------------------------------------------------------------------- $rcsfile: lib_app.php,v $ purpose: defines app class. class container application global variables such database connection. copyright: 2003 ** author omitted ** --------------------------------------------------------------------------- functions: - none classes: app - global application class, holds global variables --------------------------------------------------------------------------- $log: lib_app.php,v $ revision 1.1.1.1 2004/08/05 23:50:39 ** author omitted ** --------------------------------------------------------------------------*/ if (!defined('php_app')) die('<br>'.__file__.': program cannot function without application framework<br>'); class app{ var $dsn; // db connection string var $db; // db connection object var $state; // application status var $debug = config_debug; // debug status function app($dsn){ $this->dsn = $dsn; $this->db = db::connect($dsn); if (db::iserror($this->db)) { die($this->db->getmessage() . ' module: ' . __file__ . ' line: ' . __line__ ); } } } // class ?> please, has solved problem, able assist? i've referenced many other sites including number on stack. nada.
appendment: we're clear, haters out there ask me "learn pdo" or "bury relic , put salt on it", while hilarious , appreciated, please note not code. in fact relic should buried. however, back-end customer management program "came with" client whom designed , coded lot of front-end stuff, requested admin area not touched. i'm not going rewrite whole darn thing if i'm not being paid it, solve greater community of people out there:
http://pear.php.net/bugs/bug.php?id=12057
http://php.brickhost.com/forums/index.php?topic=10756.0
error message strict standards: non-static method should not called statically in php
http://forums.phpfreaks.com/topic/265563-help-me-non-static-method-db/
http://forums.codewalkers.com/pear-packages-47/non-static-method-warnings-php-5t-4796.html
for greater community of people out there have received 0 answers relevant particular situation, , more poking , prodding antiquated code else.
let me lay on you. have downgraded php 5.3, error no longer appearing. works fine. there needs kind of answer problem has been missed among laughing , pointing, , quick "duh... turn off error reporting" (which doesn't work), , nonspecific comments on declaring non-static variable (derr). no $@#! guys. if simple, wouldn't have posted on stack.
for own benefit? not anymore. fact is, there many people looking answers not find them elsewhere. hope here can find solution. if not, believe me, won't losing sleep it.
sorry man,
but pearl it's obsolete or successor mdb2 , consider upgrading pdo insted
for details... pdo
Comments
Post a Comment