SA-MP Forums Archive
How to load information from MySQL ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to load information from MySQL ? (/showthread.php?tid=574291)



How to load information from MySQL ? - SandKing94 - 15.05.2015

I am trying to load user's name and pass but i cant and get errors in mysql_log
I am using latest MySQL plugin (BlueG's)
Code:
Код:
new query[200];
    format(query,sizeof(query),"user WHERE user ='%s'",name(playerid));
    cache_get_row(0, 0, pInfo[playerid][user]);
	format(query,sizeof(query),"pass WHERE user ='%s'",name(playerid));
	cache_get_row(0, 1, pInfo[playerid][pass]);
But it doesnt work and i get error message in mysql_log:
Код:
[21:23:02] [DEBUG] cache_get_field_content - row: 1, field_name: "pass WHERE user ='asd'", connection: 1, max_len: 1
[21:23:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[21:23:02] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[21:23:06] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM players WHERE user='asd' AND pass ='test'", callback: "checkpass", format: "i"
[21:23:06] [DEBUG] CMySQLQuery::Execute[checkpass] - starting query execution
[21:23:06] [DEBUG] CMySQLQuery::Execute[checkpass] - query was successfully executed within 0.270 milliseconds
[21:23:06] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[21:23:06] [DEBUG] Calling callback "checkpass"..
[21:23:06] [DEBUG] cache_get_field_content - row: 1, field_name: "pass WHERE user ='asd'", connection: 1, max_len: 1
[21:23:06] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[21:23:06] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called



Re: How to load information from MySQL ? - PT - 15.05.2015

SELECT FROM

You need learn SQL.


Re: How to load information from MySQL ? - Vince - 15.05.2015

I don't think you know how to write even the most basic of queries. And since you're one such selfish person who deletes his messages after he gets help, I can't be bothered. Learn some SQL first.