Error: Call to a member function sql_query() on null

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
jordanmbush
Registered User
Posts: 3
Joined: Wed Nov 15, 2017 3:37 pm

Error: Call to a member function sql_query() on null

Post by jordanmbush » Wed Nov 29, 2017 12:14 am

Hello,

I am having a strange error when calling a php file. The php just runs a sql query, and I just include common.php to get my connection. I do an ajax request to run the php file, but the error is with a line in my php file that uses the sql_query() function. For some reason, I am getting a fatal error message that says, "Call to a member function sql_query() on null. Any experience with something like this?

User avatar
AbaddonOrmuz
Registered User
Posts: 219
Joined: Wed Dec 25, 2013 9:06 pm
Location: /dev/null
Name: Alfredo Ramos
Contact:

Re: Error: Call to a member function sql_query() on null

Post by AbaddonOrmuz » Wed Nov 29, 2017 4:50 am

If you're using something like:

Code: Select all

$db->sql_query('...');
It means that $db is not defined, it's not an instance of the database handler.
A proudly user of Arch Linux :: /r/sddm_themes

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 20431
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Error: Call to a member function sql_query() on null

Post by RMcGirr83 » Wed Nov 29, 2017 10:35 am

Probably help if the OP posted the code he/she is using.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

Post Reply

Return to “phpBB Custom Coding”

Who is online

Users browsing this forum: No registered users and 12 guests

cron