Why it's not working ?
#1

I get no error even in the MySQL log file but it's not saving why ?

Код:
stock SaveBankAccounts()
{
	new DB_Query[200];
	for(new i= 1; i <= MAX_BANK_ACCOUNTS; i++)
	{
	    if(bAccount[i][Used])
	    {
	        mysql_format(Database, DB_Query, sizeof(DB_Query),"UPDATE `BANKACCOUNTS` SET `VALUE` = %d WHERE `ID` = %d LIMIT 1",
	        bAccount[i][Value], i);
	        mysql_tquery(Database, DB_Query);
	    }
	}
	return 1;
}
stock SaveBusiness()
{
	new DB_Query[1000];
	for(new i; i < MAX_BUSINESS; i++)
	{
	    if(Business[i][Used])
	    {
			mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `BUSINESS` SET `TYPE` = %d, `PRODUCT` = %d, `FEE` = %d, `SAFE` = %d, `VW` = %d, `INT` = %d, `IINT` = %d, `OWNER` = %d, `PRICE` = %d, `PosX` = %f, `PosY` = %f, `PosZ` = %f, `CpPosX` = %f, `CpPosY` = %f, `CpPosZ` = %f, `IPosX` = %f, `IPosY` = %f, `IPosZ` = %f WHERE `ID` = %d LIMIT 1",
			Business[i][Type],Business[i][Product],Business[i][Fee],Business[i][Safe],Business[i][Vw],Business[i][Int],Business[i][IInt],Business[i][Owner],Business[i][Price],Business[i][PosX],Business[i][PosY],Business[i][PosZ],Business[i][CpPosX],Business[i][CpPosY],Business[i][CpPosZ],Business[i][IPosX],Business[i][IPosY],Business[i][IPosZ],i);
			mysql_tquery(Database, DB_Query);
		}
	}
	return 1;
}
Reply
#2

PHP код:
SaveBusiness();
SaveBankAccounts(); 
Do you have this in your command or whatever?
Reply
#3

Yes under OnGameModeExit
Reply
#4

You're making the same mistake once again, please carefully read something you're told.

PHP код:
for(new i1<= MAX_BANK_ACCOUNTSi++) 
If you start the loop with 1, the first row in MySQL won't be read because they start from 0.
And don't put equality sign (=)
Reply
#5

And what about the business save ?

EDIT: It didn't work tho..
EDIT: It should start from 1 because the the bankaccounts ID starts with 1 not 0
Reply
#6

Try this and if doesn't work, check your server log and see whether the message is printed.
PHP код:
stock SaveBankAccounts()
{
    new 
query[256];
    for(new 
1MAX_BANK_ACCOUNTSi++)
    {
        if(
bAccount[i][Used])
        {
            print(
"Is variable true test");
            
mysql_format(Databasequerysizeof(query), "UPDATE `BANKACCOUNTS` SET `VALUE`='%d' WHERE `ID`='%d' LIMIT 1"bAccount[i][Value], i);
            
mysql_query(Databasequery);
        }
    }

Quote:
Originally Posted by Nru
Посмотреть сообщение
EDIT: It should start from 1 because the the bankaccounts ID starts with 1 not 0
You're right, my bad. Sorry about that.
Reply
#7

Quote:
Originally Posted by kovac
Посмотреть сообщение
Try this and if doesn't work, check your server log and see whether the message is printed.
PHP код:
stock SaveBankAccounts()
{
    new 
query[256];
    for(new 
1MAX_BANK_ACCOUNTSi++)
    {
        if(
bAccount[i][Used])
        {
            print(
"Is variable true test");
            
mysql_format(Databasequerysizeof(query), "UPDATE `BANKACCOUNTS` SET `VALUE`='%d' WHERE `ID`='%d' LIMIT 1"bAccount[i][Value], i);
            
mysql_query(Databasequery);
        }
    }


You're right, my bad. Sorry about that.
Thank you it worked fine now +REP <3
Reply
#8

Quote:
Originally Posted by Nru
Посмотреть сообщение
Thank you it worked fine now +REP <3
I'm glad, thanks

And then for businesses try this:
PHP код:
stock SaveBusiness()
{
    new 
query[1000];
    for(new 
1MAX_BUSINESSi++)
    {
        if(
Business[i][Used])
        {
            
mysql_format(querysizeof(query), "UPDATE `BUSINESS` SET `TYPE`='%d', `PRODUCT`= '%d',`FEE`= '%d', `SAFE`='%d', `VW`='%d', `INT`='%d',`IINT`='%d',`OWNER`='%d', `PRICE`='%d', `PosX`='%f', `PosY`='%f', `PosZ`='%f', `CpPosX`='%f',`CpPosY`='%f', `CpPosZ`= '%f', `IPosX`='%f', `IPosY`='%f',`IPosZ`='%f' WHERE `ID`='%d' LIMIT 1",
            
Business[i][Type],Business[i][Product],Business[i][Fee],Business[i][Safe],Business[i][Vw],Business[i][Int],Business[i][IInt],Business[i][Owner],Business[i][Price],Business[i][PosX],Business[i][PosY],Business[i][PosZ],Business[i][CpPosX],Business[i][CpPosY],Business[i][CpPosZ],Business[i][IPosX],Business[i][IPosY],Business[i][IPosZ],i);
            
mysql_query(Databasequery);
        }
    }

Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)