mysql

Posted in General by Silvio Fri Feb 07 2020 10:41:26 GMT+0000 (Coordinated Universal Time)·1·Viewed 191 times

can't find anything on mysql connection (to insert/grab data on request) can someone help?
May 13, 2020

$discord->on('ready', function ($discord) {
$GLOBALS['mysqli'] = $this->mysqlConnection();
if($GLOBALS['mysqli'] !== false){
echo "Mysql is ready.", PHP_EOL;
}
});

private function mysqlConnection(){
$mysqli = new mysqli($GLOBALS['hostMysql'], $GLOBALS['loginMysql'], $GLOBALS['passwordMysql'], $GLOBALS['dbNameMysql']);

    if (mysqli_connect_error()) {
        echo "Error: Unable to connect to MySQL." . PHP_EOL;
        echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
        echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
        exit;
    }

    echo "Success: A proper connection to MySQL was made! The my_db database is great." . PHP_EOL;
    echo "Host information: " . mysqli_get_host_info($mysqli) . PHP_EOL;

   return $mysqli;
}
  
Markdown is allowed