[MYSQL] Help to extract a data - 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] Help to extract a data (
/showthread.php?tid=675643)
[MYSQL] Help to extract a data -
Marroquin - 17.05.2020
I had already created a topic, but I decided to delete it because it did not explain very well so I create it again explaining well what is happening to me.
When it comes to recovering the data from the database, it happens to me that if I leave "0" in this line:
cache_get_value_int (0, "Arma1", a);
He always extracts the player's weapons from column 0, which as you can see is "Carlos_Marroquin". I want "0" to be chosen according to the player who enters, I have the variable "ID_WEAPON" which increases as the Players, how can I get the data of that row, to use it instead of "0"?
I leave the photos of everything down here
This is inside another function that is called from OnPlayerConnect when a player logs correctly.
Re: [MYSQL] Help to extract a data -
Mugala - 17.05.2020
Hello, you have to change MySQL query, to detect that, you have to use
PHP Code:
SELECT `ID_WEAPON` FROM `PLAYER_WEAPONS` WHERE `NAME_USER` = '%s'
%s means PlayerName(playerid)
Re: [MYSQL] Help to extract a data -
Adamoneoone - 17.05.2020
You should use %e instead of %s or escape the string first to avoid any SQL Injection.
Re: [MYSQL] Help to extract a data -
Marroquin - 17.05.2020
Quote:
Originally Posted by Mugala
Hello, you have to change MySQL query, to detect that, you have to use
PHP Code:
SELECT `ID_WEAPON` FROM `PLAYER_WEAPONS` WHERE `NAME_USER` = '%s'
%s means PlayerName(playerid)
|
Muchas gracias, esto me solucionу el problema
Re: [MYSQL] Help to extract a data -
Marroquin - 17.05.2020
Quote:
Originally Posted by Mugala
Hello, you have to change MySQL query, to detect that, you have to use
PHP Code:
SELECT `ID_WEAPON` FROM `PLAYER_WEAPONS` WHERE `NAME_USER` = '%s'
%s means PlayerName(playerid)
|
Thank you very much, this solved the problem for me