Need assistance with connection to external database

AlexGallagherr

New member
Hey everyone, we're looking for some help using the database adapter we were told to use for XF. Below is the code we're trying to run, but it's getting caught up on very basic and essential SQL syntax for some reason.

PHP:
<?php



    $game_db = new \XF\Db\Mysqli\Adapter([

        'host' => '**.***.***.***',

        'port' => 3306,

        'username' => '****',

        'password' => '****',

        'dbname' => 'game'

    ], true);



    // Check connection

    if (!$game_db) {

        die("Connection failed: " . mysqli_connect_error());

    }



    $statement = $game_db->query("

            DECLARE @fromUserID INT");



?>

The query is producing the following error

<!-- MySQL statement prepare error [1064]: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DECLARE @fromUserID INT = -1

Is there something we missed here? I've tried every syntax of SQL variable declaration I can find, so I'm assuming we have something else incorrect here. Thank you.
 
Top