[MYSQL] Help to extract a data
#1

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.

Reply
#2

Hello, you have to change MySQL query, to detect that, you have to use
PHP Code:
SELECT `ID_WEAPONFROM `PLAYER_WEAPONSWHERE `NAME_USER` = '%s' 
%s means PlayerName(playerid)
Reply
#3

You should use %e instead of %s or escape the string first to avoid any SQL Injection.
Reply
#4

Quote:
Originally Posted by Mugala
View Post
Hello, you have to change MySQL query, to detect that, you have to use
PHP Code:
SELECT `ID_WEAPONFROM `PLAYER_WEAPONSWHERE `NAME_USER` = '%s' 
%s means PlayerName(playerid)
Muchas gracias, esto me solucionу el problema
Reply
#5

Quote:
Originally Posted by Mugala
View Post
Hello, you have to change MySQL query, to detect that, you have to use
PHP Code:
SELECT `ID_WEAPONFROM `PLAYER_WEAPONSWHERE `NAME_USER` = '%s' 
%s means PlayerName(playerid)
Thank you very much, this solved the problem for me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)