Banks in mysql [+REP]
#5

Quote:
Originally Posted by IzadorO
Посмотреть сообщение
Код:
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.
Thank you very much!
That's a complete answer.
+1337REP
Reply


Messages In This Thread
Banks in mysql [+REP] - by E7mad - 21.12.2015, 15:33
Re: Banks in mysql [+REP] - by VVWVV - 21.12.2015, 15:38
Re: Banks in mysql [+REP] - by SecretBoss - 21.12.2015, 15:42
Re: Banks in mysql [+REP] - by IzadorO - 21.12.2015, 19:07
Re: Banks in mysql [+REP] - by E7mad - 22.12.2015, 11:02
Re: Banks in mysql [+REP] - by E7mad - 22.12.2015, 11:07
Re: Banks in mysql [+REP] - by E7mad - 22.12.2015, 14:45

Forum Jump:


Users browsing this thread: 1 Guest(s)