Data from array to mysql query
#5

You need to clear the string whenever the outermost for-loop runs.
pawn Код:
CMD:importloads(playerid, params[])
{
    new string[512];
    for(new i; i < 1000; i++)
    {  
        string[0] = 0; // Clear the string (just clear the first character)
    // LoadName, MafiaLoad, PayPerUnit, VehicleNeeded, From-Locations, To-Locations
        printf("%s", ALoads[i][LoadName]);
        printf("%f", ALoads[i][PayPerUnit]);
        printf("%i", ALoads[i][PCV_Required]);
        for(new a; a < 10; a++)
        {
            if(ALoads[i][FromLocations][a] != 0)
            {
                printf("From: %i", ALoads[i][FromLocations][a]);
                format(string, sizeof(string), "%s, %i", string, ALoads[i][FromLocations][a]);
            }
            if(ALoads[i][ToLocations][a] != 0)
            {
               printf("To: %i", ALoads[i][ToLocations][a]);
            }
        }
        print(string);
    }
   
    return 1;
}
Reply


Messages In This Thread
Data from array to mysql query - by thimo - 04.12.2014, 14:38
Re: Data from array to mysql query - by thimo - 04.12.2014, 16:20
Re: Data from array to mysql query - by Write - 04.12.2014, 16:22
Re: Data from array to mysql query - by thimo - 04.12.2014, 16:32
Re: Data from array to mysql query - by PowerPC603 - 04.12.2014, 17:34
Re: Data from array to mysql query - by thimo - 04.12.2014, 21:04

Forum Jump:


Users browsing this thread: 2 Guest(s)