Switched from MySQL to MySQLi requires the connection parameter I was working with really old PHP I learned years ago and decided to finally update it, so I changed all the mysql to mysqli. I noticed some MySQLi functions require you to pass the connection in the parameters. I ended doing something like this:

$con = getCon();
$result = mysqli_query($con, "SELECT * FROM sometable WHERE deleted=0");


getCon() is a return like return Database::getConnection(); that uses the next class:

class Database {
    private static $db;
    private $connection;

    private function __construct() {
        $servername = "localhost";
        $username = "...";
        $password = "...";
        $dbname = "...";

        $this-&gt;connection = new mysqli($servername, $username, $password, $dbname);
    }

    function __destruct() {
        $this-&gt;connection-&gt;close();
    }

    public static function getConnection() {
        if(self::$db == null) {
            self::$db=new Database();
        }

        return self::$db-&gt;connection;
    }
}


I don't like adding the line $con = getCon(); to the top of every function that uses mysqli_query. Is there a way to avoid this? (it is one extra line multiplied by every function that uses mysqli calls)
Use object-oriented style:

$con = getCon();
$result = $con-&gt;query("SELECT * FROM sometable WHERE deleted=0");


Refer to Example #1 on the PHP documentation for mysqli_query(), as well as the Dual interface quick start page for more information. 

Looking back at the functions like deprecated mysql_query() it appears that it used the "last link opened by mysql_connect()". If you really wanted to replicate that, you could define a wrapper function (potentially using call_user_func()):

function mysqli_query_con($query, $resultmode = MYSQLI_STORE_RESULT)
    $con = getCon();
    return mysqli_query($con, $query, $resultmode);
}