Problem with Loading Vehicles
#1

pawn Код:
mysql_query("SELECT * FROM `vehicles` ORDER BY `SQLid` ASC");
    mysql_store_result();

    new carid;
    while(mysql_fetch_row(resultline)==1)
MYSQL ERROR:

Код:
[20:23:29] MySQL Error (0): Function: 'mysql_fetch_row' called when no result stored.
Reply
#2

Sorry, but what does
pawn Код:
while(mysql_fetch_row(resultline)==1)
 ==1//I mean this
stannd for ? Sorry, just haven't seen it before. Anyways this is what I use
pawn Код:
while(mysql_fetch_row(string,"|"))
            {
                if(mysql_num_rows() == 0) continue;
or else

pawn Код:
//Top of script
#define LOAD_VEHICLES 1
//I call this on GamemOdeInit
Function: LoadVehicles()
{
    mysql_query("SELECT * FROM `Vehicles` ORDER BY `vehicleid` ASC", LOAD_VEHICLES);
}

//under OnMysqlQuery
        case LOAD_VEHICLES:
        {
            mysql_store_result();
            new data[42][128];
            while(mysql_fetch_row(string,"|"))
            {
                if(mysql_num_rows() == 0) continue;
                explode(data, string, "|");
                //printf(string);
                new Carid = CreateVehicle(strval(data[1]), floatstr(data[2]), floatstr(data[3]), floatstr(data[4]), floatstr(data[5]), strval(data[6]), strval(data[7]), -1);
                printf("Loading Vehicle Data id %i: %s", Carid, string);
                VehicleInfo[Carid][vSQLID] = strval(data[0]);
                VehicleInfo[Carid][vModel] = strval(data[1]);
//etc...
Reply
#3

Thats how I was taught to do it. It used to work, just stopped.. for some reason.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)