27.04.2014, 14:20
I'm using MySQL for data saving. I'm trying to save server data such as passwords for factions, the current tax rate, etc, because I want it all to be dynamic. However, I'm brain farting majorly and I cannot figure out how to format the table for the server data. Currently, each piece of data is marked by the "class" column. This, however, is my problem. I'm trying to select the data via a string rather than an id number and I'm not entirely sure I'm doing it correctly. So, how can I select data with a string?
Here is what I have currently:
I did this at 4am so I know it looks silly.
Here is what I have currently:
pawn Код:
new query[128], classid[8];
format(query, sizeof(query), "SELECT * FROM `passwords` WHERE `class` = '%s'", classid);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query, "|"))
{
new tablevalue[16];
strpack(classid, "l1a");
mysql_fetch_field_row(tablevalue, "password"); strpack(Password_L1A, tablevalue);
strpack(classid, "l2a");
mysql_fetch_field_row(tablevalue, "password"); strpack(Password_L2A, tablevalue);
strpack(classid, "l3s");
mysql_fetch_field_row(tablevalue, "password"); strpack(Password_L3S, tablevalue);
strpack(classid, "l4r");
mysql_fetch_field_row(tablevalue, "password"); strpack(Password_L4R, tablevalue);
strpack(classid, "l5m");
mysql_fetch_field_row(tablevalue, "password"); strpack(Password_L5M, tablevalue);
strpack(classid, "lvpd");
mysql_fetch_field_row(tablevalue, "password"); strpack(Password_LVPD, tablevalue);
}