[MYSQL]Query something different to each row
#1

Okay so what i want to do is being abled to query different things to each row while using the same thing.. Is that possible. Here is the code i got so far:
pawn Код:
forward OnPlayerHousesVehiclesLoad(playerid, houseid_);
public OnPlayerHousesVehiclesLoad(playerid, houseid_)
{
    printf( "OnPlayerHousesVehiclesLoad::houseid_ = %d", houseid_ );
    new rows, fields, string[128];
    cache_get_data( rows, fields, Handle );

    if( rows )
    {
        print("There are rows - Vehicles");
        new
        idx = 0,
        cmodel2, Float: cx2, Float: cy2, Float: cz2, Float: crot2, ccol1, ccol2
        ;
        while( rows > idx )
        {
            cmodel2 = cache_get_row_int( idx, 2 );
            cx2 = cache_get_row_float( idx, 3 );
            cy2 = cache_get_row_float( idx, 4 );
            cz2 = cache_get_row_float( idx, 5 );
            crot2 = cache_get_row_float( idx, 6 );
            ccol1 = cache_get_row_int( idx, 7 );
            ccol2 = cache_get_row_int( idx, 8 );

            format(string, sizeof(string), "UPDATE Vehicles SET CarSlot = %d WHERE HouseID = %d AND X = %f AND Y = %f AND Z = %f AND Rot = %f", idx , houseid_, cx2 , cy2 , cz2, crot2);
            mysql_function_query( Handle, string, false, "", "" );
            printf("House_AddVehicle(%d,%d,%f,%f,%f,%f,%d,%d);", houseid_, cmodel2, cx2, cy2, cz2, crot2, ccol1, ccol2);
            House_AddVehicle(houseid_, cmodel2, cx2, cy2, cz2, crot2, ccol1, ccol2);
            print("Car loaded");

            idx++;
        }
    }
    return 1;
}
How can you go from row to row and assign different values to different rows?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)