SA-MP Forums Archive
mysql question - 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 question (/showthread.php?tid=607834)



mysql question - ilijap - 24.05.2016

Mysql plugin from Blue is different from the php one (normal). Save system is same but I cant figure out how does load system works.
PHP код:
PlayerInfo[playerid][pScore] = cache_get_field_content_int(0"Score"connection
This is the code and I cant figure out where does that 0 comes from and will this work only for player id 0 ingame?


Re: mysql question - Konstantinos - 24.05.2016

The first parameter is the rowid. It is 0 because there is only 1 row in the table with the player's name.

If for example you have selected all the data from a table without a WHERE clause in the query, you'd have to use a loop and use the variable for the rowid:
pawn Код:
for (new i, j = cache_get_row_count(); i != j; i++)
{
    ... = cache_get_field_content_int(i, "...");
}



Re: mysql question - ilijap - 24.05.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
The first parameter is the rowid. It is 0 because there is only 1 row in the table with the player's name.

If for example you have selected all the data from a table without a WHERE clause in the query, you'd have to use a loop and use the variable for the rowid:
pawn Код:
for (new i, j = cache_get_row_count(); i != j; i++)
{
    ... = cache_get_field_content_int(i, "...");
}
Oh thanks That would be useful for other systems


Re: mysql question - JasperM - 24.05.2016

Quote:
Originally Posted by ilijap
Посмотреть сообщение
Mysql plugin from Blue is different from the php one (normal).
What the heck do you mean with that lol. Obviously the code is different, but the SQL syntax stays the same.


Re: mysql question - ilijap - 24.05.2016

Quote:
Originally Posted by JasperM
Посмотреть сообщение
What the heck do you mean with that lol. Obviously the code is different, but the SQL syntax stays the same.
IK that SQL Syntax is same but some functions are different