SQL & loop problem
#1

Alright so the problem is quite simple, it saves factory data for 2-3 but not for 1

PHP код:
public OnFactoryLoad()
{
    new 
rowsfields;
    
cache_get_data(rowsfieldsmysql);
    if(
rows)
    {
        for(new 
1rows && MAX_FACTORIESi++)
        {
            
FactoryData[i][FactoryID] = cache_get_field_content_int(i,"ID");
            
FactoryData[i][FactoryResources] = cache_get_field_content_int(i,"Resources");
        }
    }
    return 
true;
}
SaveFactories() {
    new 
query[128];
    for(new 
1MAX_FACTORIESx++) {
        
mysql_format(mysqlquerysizeof(query), "UPDATE `factories` SET `Resources`=%f WHERE `ID`=%d",\
        
FactoryData[x][FactoryResources],FactoryData[x][FactoryID]);
    }
    return 
true;
}
CMD:test(playerid,params[]) {
    
FactoryData[1][FactoryResources] = 500;
    
FactoryData[2][FactoryResources] = 6520;
    
FactoryData[3][FactoryResources] = 3000;
    return 
true;

Reply


Messages In This Thread
SQL & loop problem - by TwinkiDaBoss - 15.12.2015, 01:40
Re: SQL & loop problem - by zPain - 15.12.2015, 01:44
Re: SQL & loop problem - by TwinkiDaBoss - 15.12.2015, 01:53
Re: SQL & loop problem - by zPain - 15.12.2015, 01:57
Re: SQL & loop problem - by TwinkiDaBoss - 15.12.2015, 02:04
Re: SQL & loop problem - by zPain - 15.12.2015, 02:28
Re: SQL & loop problem - by TwinkiDaBoss - 15.12.2015, 02:32
Re: SQL & loop problem - by Vince - 15.12.2015, 08:42
Re: SQL & loop problem - by vassilis - 15.12.2015, 13:01
Re: SQL & loop problem - by TwinkiDaBoss - 15.12.2015, 14:33

Forum Jump:


Users browsing this thread: 2 Guest(s)