Crustyfur Posted May 27, 2007 Share Posted May 27, 2007 Is this a error cuased by lack of declaration of $db? <?php function newscommentsent() { global $pagetitle, $result; $pagetitle = "Fleet Town, Hampshire - News Comment Sent"; $result = $db->sql_query("INSERT INTO ".$prefix."_bus_pending (feildname) //--snip ?> Quote Link to comment https://forums.phpfreaks.com/topic/53160-solved-fatal-error-call-to-a-member-function-on-a-non-object/ Share on other sites More sharing options...
MadTechie Posted May 27, 2007 Share Posted May 27, 2007 $result = $db->sql_query("INSERT INTO ".$prefix."_bus_pending (feildname) is incompleate and $db isn't called ie $db = new classname; Quote Link to comment https://forums.phpfreaks.com/topic/53160-solved-fatal-error-call-to-a-member-function-on-a-non-object/#findComment-262616 Share on other sites More sharing options...
Diego17 Posted May 27, 2007 Share Posted May 27, 2007 Is $db global object, too? Like $pagetitle and $result are? must be global $pagetitle, $result, $db; then. Quote Link to comment https://forums.phpfreaks.com/topic/53160-solved-fatal-error-call-to-a-member-function-on-a-non-object/#findComment-262627 Share on other sites More sharing options...
Crustyfur Posted May 27, 2007 Author Share Posted May 27, 2007 Is $db global object, too? Like $pagetitle and $result are? must be global $pagetitle, $result, $db; then. That did it. I was looking at it for so long I was blind to the obvious. Cheers Diego Chris Quote Link to comment https://forums.phpfreaks.com/topic/53160-solved-fatal-error-call-to-a-member-function-on-a-non-object/#findComment-262649 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.