Get data from mysql, and use it. - 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: Get data from mysql, and use it. (
/showthread.php?tid=545300)
Get data from mysql, and use it. -
TheINCDope - 07.11.2014
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new haI = 1; haI < MAX_HOUSES; haI++)
{
new
Str[24],
hID;
mysql_query("SELECT * FROM `houses`");
mysql_store_result();
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row(Str))
{
sscanf(Str, "p<|>is[128]", hID);
if(pickupid == HousePickup[hID])
{
GameTextForPlayer(playerid, "~w~Type ~r~/enter~w~ to go inside: ", 5000, 5);
}
iHos[haI][haID] = haI;
}
}
mysql_free_result();
}
return 1;
}
Used for loop, and trying to add itto pickuppickup, as ID from hID row "houses" table. Doesnt work, it says its wrong, I think it gets only how mutch rows there is. not the ID
Re: Get data from mysql, and use it. -
TheINCDope - 07.11.2014
Quote:
Originally Posted by ******
SQL is a whole other language (that's what the "L" stands for), so learn it like you would learn PAWN. Read the documentation, follow tutorials, study examples, THEN try apply it within PAWN. Far too often it seems that the attitude around here is that you learn PAWN and just stick some simple SQL on the end, but that shouldn't be how it is - they are both languages that need learning (and SQL is possibly more complex and extensive than PAWN so will take longer to learn).
|
I figured. Thanks, I will learn it, Im learning it actuoally, since I saw no one is helping, read half of arcticles on wiki, and yeh I see pawno is more simple.
Btw Im not asking to fix this script for me, can you please tell me witch place I did wrong, maybe I mixed things up, and can u tell me is this code is good I mean optimized? Or i should do it in some other way?