Housesystem - Problem - 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: Housesystem - Problem (
/showthread.php?tid=301902)
[MYSQL] Housesystem - Problem -
Sorato - 06.12.2011
Hello Community =),
i am currently working on an own housesystem and want to load the tenants, that are in my mysql table, with "OnGameModeInit",
but if i want to give out the tenants (names..) i only get the first name.
here is the code:
Код:
stock LoadHouseTenants()
{
new id[16], idd[16];
new Tenantname[128];
for (new i = 1; i <= mysql_GetEntries("housedata"); i++)
{
format(idd, sizeof(idd), "%d", i);
for (new j = 1; j <= mysql_GetEntriesByKey("housetenants", "houseid", idd); j++)
{
format(id, sizeof(id), "%d", j);
Tenantname = mysql_GetString("housetenants", "tenantname", "houseid", id);
printf("Tenant Number %d: %s", j, Tenantname);
}
}
}
mysql_GetEntries("housedata"); // only counts the entrys in the database
mysql_GetEntriesByKey("housetenants", "houseid", idd); //counts entrys in which the value of the column is "houseid" = "idd"
mysql_GetString("housetenants", "tenantname", "houseid", id);
Код:
stock mysql_GetString(Table[], Field[], Where[], Is[])
{
new query[128], Get[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT %s FROM %s WHERE %s = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
mysql_fetch_row(Get);
return Get;
}
The Console output is:
Tenant Number 1: Sorato
Tenant Number 2:
Tenant Number 3:
Please Help
Thank you
Greetings Sorato
P.S.: My english isn't so good, because im german.
AW: Housesystem - Problem -
Sorato - 07.12.2011
pls help me
Re: Housesystem - Problem -
English-Conceptz - 07.12.2011
try not to bump unless you have to, older members get stressy
![Wink](images/smilies/wink.png)
il give you a bump now n then if this goes un-answered