06.12.2011, 12:00
(
Последний раз редактировалось Sorato; 06.12.2011 в 13:27.
)
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:
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);
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.
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_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; }
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.