#include <Array.au3>
#include <MySQL.au3>
Dim $sDBName = "test"
Dim $sHost = "localhost"
Dim $sLogin = "root"
Dim $sPassw = "root"
Dim $sQuery = 'INSERT INTO `accounts` (`login`, `password`, `email`) VALUES ("login", "Password", "Mail")'
_MySQL_InitLibrary()
If @error Then
MsgBox(16, @ScriptName, "Error open library!")
Exit
EndIf
$hMySQL = _MySQL_Init()
If @error Then
MsgBox(16, @ScriptName, _MySQL_Error($hMySQL) & " (" & _MySQL_Errno($hMySQL) & ")")
Exit
EndIf
$hConnect = _MySQL_Real_Connect($hMySQL, $sHost, $sLogin, $sPassw, $sDBName)
If @error Then
MsgBox(16, @ScriptName, _MySQL_Error($hMySQL) & " (" & _MySQL_Errno($hMySQL) & ")")
Exit
EndIf
ConsoleWrite(">> Successful connection..." & @CRLF)
If _MySQL_Real_Query($hConnect, $sQuery) Then
MsgBox(16, @ScriptName, _MySQL_Error($hMySQL) & " (" & _MySQL_Errno($hMySQL) & ")")
Exit
Else
ConsoleWrite(">> Successful query..." & @CRLF)
$hResult = _MySQL_Store_Result($hConnect)
If $hResult Then
$aResult = _MySQL_Fetch_Result_StringArray($hResult)
_ArrayDisplay($aResult)
EndIf
EndIf
_MySQL_Free_Result($hResult)
_MySQL_Close($hMySQL)
_MySQL_EndLibrary()