Page 1 of 1

Trying to fix deprecated functions

Posted: Sun Aug 06, 2023 3:32 am
by gsmiley007
So i'm use the @raiwa spreadsheet

tep_db_query("SHOW CHARACTER SET") $db->query("SHOW CHARACTER SET")

for an plugin in the admin.

it throws an error

[05-Aug-2023 23:28:19 America/Toronto] PHP Warning: Undefined variable $db
[05-Aug-2023 23:28:19 America/Toronto] PHP Fatal error: Uncaught Error: Call to a member function query() on null

Re: Trying to fix deprecated functions

Posted: Sun Aug 06, 2023 6:14 am
by Kofod95
Try

Code: Select all

$GLOBALS['db']->query("SHOW CHARACTER SET")
If application_top isn't loaded in the file directly, we need to fetch the classes from the global.

At times, we might also be calling classes (via hooks) before they are instanciated in application_top. In those cases there is the Guarantor::ensure_global() method. If called inside an action or similar, add a \ (I think that is due to name spaces, but I really don't understand that much) ;)

//Daniel

Re: Trying to fix deprecated functions

Posted: Sun Aug 06, 2023 3:42 pm
by gsmiley007
thanks, that worked