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 ?> 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; 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. 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 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
Archived
This topic is now archived and is closed to further replies.