rewrite query.php with mysqli functions