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
Trying to fix deprecated functions
-
gsmiley007
- Member
- Posts: 82
- Joined: Sun Mar 14, 2021 9:28 pm
- Phoenix Version:
- Has thanked: 9 times
- Been thanked: 2 times
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: Trying to fix deprecated functions
Try
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
Code: Select all
$GLOBALS['db']->query("SHOW CHARACTER SET")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
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
-
gsmiley007
- Member
- Posts: 82
- Joined: Sun Mar 14, 2021 9:28 pm
- Phoenix Version:
- Has thanked: 9 times
- Been thanked: 2 times