invalid get index '0'( on base: 'Nil').

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By joleera

this playerids

extends Node
var db_user = “root”
var db =
func _ready():
var auth_ok = db.set_authtype(MariaDB.AUTH_SRC_SCRIPT, MariaDB.AUTH_TYPE_MYSQL_NATIVE, false);
print(‘IsAuthOk: ‘, auth_ok)
var connect_ok= db.connect_db(“localhost”,3306,“godot”,db_user,“91270016”)
print(‘IsConnected: ‘, connect_ok)
#var testquery = db.query(‘SELECT password FROM users WHERE password = "’+str(password)+’"’)
var testquery = db.query(‘SELECT password FROM users WHERE username = username’)
func InfoIdPlayer(username):
db.query(‘SELECT password FROM users WHERE username = "’+str(username)+’"’)


remote func AuthenticatePlayer(username, password, player_id):
var gateway_id = get_tree().get_rpc_sender_id()
var hashed_password
var token
var result
var retrieved_salt = PlayerData.InfoIdPlayer(username)[0].salt
hashed_password = GenerateHashedPassword(password, retrieved_salt)
if not PlayerData.InfoIdPlayer(username)[0].password == hashed_password:
print(“incorrect pass”)
result = false
result = true

i get invalid get index ‘0’( on base: ‘Nil’).

Please format the code (via the { } editor toolbar button) and provide the complete error message.

jgodfrey | 2022-04-17 02:37

Since you linked from my answer from “mariasb/sql query login system” to here, I will put a few suggestions here.

Like jgodfrey said, provide the full error message, so we can help more.

Also since you have print statements in your code, provide the ones that have already been printed, that narrows it down to where the problem might start.

I assume you are using this extensions to connect to mariadb
GitHub - sigrudds1/godot-mariadb: A MariaDB/MySQL connector module for the Godot Engine.

I saw there could be problem to connect with localhost and possibly ipv6, but you could try “” instead which would not have this problem.

aipie | 2022-04-18 19:46