PDA

View Full Version : Aka


Loinal
08/06/2017, 11:00 PM
Ok iam trying to create /aka so


new IP[16];
GetPlayerIp(playerid, IP, sizeof(IP));
format(query,sizeof(query), "SELECT `Username` FROM `players` WHERE `IP` LIKE %s",Ip);
mysql_query(mysql,query);

so how to get names?

Loinal
08/06/2017, 11:03 PM
Also should i use threated query or normal query

Like
i can replace

mysql_query(mysql,query);
to
mysql_tquery(mysql,query);

Would be better??

also if i used tquery

mysql_query(mysql, "SELECT Username FROM players WHERE Admin = 3");
i can use tquery in this?

Kane
09/06/2017, 12:17 AM
If you're trying to just get the name, here's an example from my script:

new name[40];

mysql_format(m_Handle, query, sizeof(query), "SELECT Name FROM `players` WHERE id = %i LIMIT 1", HouseData[h][houseOwnerSQL]);
mysql_query(m_Handle, query);
cache_get_field_content(0, "Name", name);


Format name in a string afterwards.

Loinal
09/06/2017, 11:46 AM
If you're trying to just get the name, here's an example from my script:

new name[40];

mysql_format(m_Handle, query, sizeof(query), "SELECT Name FROM `players` WHERE id = %i LIMIT 1", HouseData[h][houseOwnerSQL]);
mysql_query(m_Handle, query);
cache_get_field_content(0, "Name", name);


Format name in a string afterwards.
Its "Name" or %s?
Also i asked a question for the tquery and query
Also why not using Like %d?? I want all names

TwiiKzz
09/06/2017, 02:37 PM
You have to loop through all the rows to get the names where ID is euqal to houseOwnerSQL.

Loinal
09/06/2017, 03:32 PM
You have to loop through all the rows to get the names where ID is euqal to houseOwnerSQL.

No man look at my code at the topic i need just to get all names not 1 name

Loinal
09/06/2017, 07:21 PM
bumb