Gothic Online Forums
mysql module new problem in 0.1.0 - Printable Version

+- Gothic Online Forums (https://archive.gothic-online.com)
+-- Forum: Scripting (English) (https://archive.gothic-online.com/forum-11.html)
+--- Forum: Scripting Help (https://archive.gothic-online.com/forum-12.html)
+--- Thread: mysql module new problem in 0.1.0 (/thread-2129.html)



mysql module new problem in 0.1.0 - Baster - 12.07.2017

Hi.
The problem in version 0.1.0
Return bad strings. Must return "id" "enter" "pass". Return (example): 50, 48, 46 ... There are no such values in the database in this order and quantity at all.
In the old version of the module for dev 8 everything works fine.

local query = mysql_query(Server_handler, "SELECT * FROM `player_cred` WHERE `player_name` = '"+getPlayerName(pid)+"' "); 
local row = mysql_fetch_row(query);

foreach(b in row)
print(b);


RE: mysql module new problem in 0.1.0 - Osmith - 12.07.2017

I do not quite understand what the problem is.

local query = mysql_query(Server_handler, "SELECT * FROM `player_cred` WHERE `player_name` = '"+getPlayerName(pid)+"' ");
local row = mysql_fetch_assoc(query);
print(row["id"]);
print(row["enter"]);
print(row["pass"]);


RE: mysql module new problem in 0.1.0 - Baster - 12.07.2017

I also tried using mysql_fetch_assoc. Same.
The problem is that the variable "string" will contain incomprehensible data. I do not know where they come from. Just a bunch of int values.
In this case, the "insert" work normal, and "select" returns bad data.
And in the old version of the module for dev 8 everything worked fine
Good. The problem is solved in part.
Mysql_fetch_assoc is working fine. The first time I made a mistake with the headlines.
But mysql_fetch_row still does not work, as in the old version.

I will use _assoc