MySQL "vip" is not loading! (logs) - 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: MySQL "vip" is not loading! (logs) (
/showthread.php?tid=365189)
MySQL "vip" is not loading! (logs) -
Dan. - 02.08.2012
So I have this problem, everything else is working but the VIP wont load. This is the stock:
pawn Код:
stock Login(playerid)
{
new query[128], string[64], money, score;
format(query, sizeof(query), "SELECT * FROM accounts WHERE user = '%s'", Name(playerid));
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query))
{
mysql_fetch_field_row(string, "admin"); PlayerInfo[playerid][pAdmin] = strval(string);
mysql_fetch_field_row(string, "vip"); PlayerInfo[playerid][pVIP] = strval(string);
mysql_fetch_field_row(string, "warnings"); PlayerInfo[playerid][pWarnings] = strval(string);
mysql_fetch_field_row(string, "score"); score = strval(string);
mysql_fetch_field_row(string, "money"); money = strval(string);
mysql_fetch_field_row(string, "kills"); PlayerInfo[playerid][pKills] = strval(string);
mysql_fetch_field_row(string, "deaths"); PlayerInfo[playerid][pDeaths] = strval(string);
mysql_fetch_field_row(string, "points"); PlayerInfo[playerid][pPoints] = strval(string);
}
mysql_free_result();
GivePlayerMoney(playerid, money);
SetPlayerScore(playerid, score);
PlayerInfo[playerid][pLogged] = 1;
UpdateStatsTextdraw(playerid);
SendClientMessage(playerid, C_LGREEN, "ACCOUNT: Successfully logged in.");
return 1;
}
A players' VIP level in the database is 3, but it wont load when he/she logs in.
This is the MySQL log:
pawn Код:
[11:42:52] CMySQLHandler::FetchRow() - Return: Username|c0516d978b6f895d0cf43d086f3d7245|0|3|0|48|29525|127.0.0.1|3|11|0
[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )
[11:42:52] CMySQLHandler::FetchField("admin") - 0
[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )
[11:42:52] CMySQLHandler::FetchField("vip") -
[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )
[11:42:52] CMySQLHandler::FetchField("warnings") - 0
[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )
[11:42:52] CMySQLHandler::FetchField("score") - 48
[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )
[11:42:52] CMySQLHandler::FetchField("money") - 29525
[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )
[11:42:52] CMySQLHandler::FetchField("kills") - 3
[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )
[11:42:52] CMySQLHandler::FetchField("deaths") - 11
[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )
[11:42:52] CMySQLHandler::FetchField("points") - 0
[11:42:52] >> mysql_fetch_row_format( Connection handle: 1 )
On this line you see, that the VIP level is 3 (the 2nd number)
pawn Код:
[11:42:52] CMySQLHandler::FetchRow() - Return: Username|c0516d978b6f895d0cf43d086f3d7245|0|3|0|48|29525|62.65.63.64|3|11|0
But it wont load the level 3 VIP, and in the mysql_log it says:
pawn Код:
[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )
[11:42:52] CMySQLHandler::FetchField("vip") -
Re: MySQL "vip" is not loading! (logs) -
Misiur - 02.08.2012
Are you sure the field in db is named `vip`? I suggest to try this:
pawn Код:
//Find
mysql_store_result();
//Add this under
new fname[20];
mysql_fetch_field(3, fname);
printf("The name of field is: %s", fname);
You'll see the result in console
Re: MySQL "vip" is not loading! (logs) -
Goobiiify - 02.08.2012
It's case sensitive.
Re: MySQL "vip" is not loading! (logs) -
Dan. - 02.08.2012
pawn Код:
The name of field is: VIP
Thanks for the help, I thought about this, but it was saving correctly and there it's not case sensitive. In
CREATE TABLE IF NOT EXISTS it really is case sensitive, so thank you both.