Код:
Query the following: CREATE TABLE IF NOT EXISTS `bank` (`Balance` INTEGER DEFAULT 0 NOT NULL, `Manager` VARCHAR(24), `ID` INTEGER NOT NULL PRIMARY KEY)
Create a bank enumerator for storing all of the SQL bank data in to their correct variables (and setting the bank enumerator values to their correct SQL variable).
Enumerator Example:
Код:
enum BankData
{
bID,
bBalance,
bManager[24],
};
new bData[MAX_BANK][BankData];
Updating the SQL table (example):
Код:
"UPDATE `bank` SET `Balance` = %d, `Manager` = '%s' WHERE `ID` = %d", bData[bankid][bBalance], bData[bankid][bManager], bData[bankid][bID]
Loading the bank table's data from the SQL server and storing it in to the BankData enumerator:
Код:
"SELECT * FROM `bank` WHERE `ID` = %d", bData[bankid]);
new rows, fields;
cache_get_data(rows, fields, serverhandle);
for (new i = 0; i < rows; i ++)
{
bData[bankid][bID] = cache_get_field_int(i, "ID")
bData[bankid][bBalance] = cache_get_field_int(i, "Balance")
cache_get_field_content(i, "Manager", bData[bankid][bManager], serverhandle, 24);
}
You can figure the rest out through SQL tutorials. You also have to create your own callbacks and sort the above scripting in to the correct callbacks.