I set up my global like this:
require('../scripts/mysql_db.php');
$DB = new mysql_db();
$connectid = $DB->sql_connect($mysql_host, $mysql_user , $mysql_password, $mysql_database);
I then use $DB
throughout like this:
$query1 = $DB->query('SELECT ....');
However I wrote a function to use $DB
and its not accessible for some reason:
function deletePendingRow($aOkReason, $aFailReason) {
$query99 = $DB->query('DELETE .....');
}
I think this is a basic php thing, can someone help me understand why.
The mysql_db
is here: https://github.com/Noitidart/MailtoWebmails-Backend/blob/master/scripts/mysql_db.php
Thanks
edit: i tried this:
function deletePendingRow($aOkReason, $aFailReason) use ($DB, $rowPending) {
It doesnt seem to work it tells me Parse error: syntax error, unexpected T_USE, expecting '{'
edit 2:
i also tried this:
$deletePendingRow = function($aOkReason, $aFailReason) use ($DB, $rowPending) {
};
but this throws Parse error: syntax error, unexpected T_FUNCTION in /home/a1304271/public_html/ajax/approve_pending.php