Good Morning @everybody, I am trying to Create a function on a namespaced class which returns a 'resource' type, however, I am failing to do it.
What I tried to do:#1
public function SQLQuery($query):resource
{
// the magic...
}
to be used with the folllowing syntax:
$SQL = SQLQuery('SELECT * FROM my_db');
but it resulted in:
syntax error, unexpected ':', expecting ';' or '{' because i'm running PHP 5.6 and that feature requires PHP 7...
so i have tried another method but it didn't work with me too:#2
public function SQLQuery($query, &$resrc)
{
$resrc = mysqli_query($SQLDB, $query);
// the magic...
}
SQLQuery('SELECT * FROM my_db', $resrc_var);
so i have tried another method which worked for me at least basiclly:#3
public function SQLQuery($query)
{
$resrc = mysqli_query($SQLDB, $query);
// the magic...
return $resrc;
}
$SQL = SQLQuery('SELECT * FROM my_db');