db_get_field_assoc
#4

This is not a good way to load the data. Send only a single query and use a loop. Plus an extra variable for the ID so instead of the array index, you will have a way to recognize in the database. An example:
PHP код:
Plants_Load()
{
    new 
DBResultdbresult db_query(database"SELECT * FROM plants ORDER BY id");
    for (new 
idb_num_rows(dbresult); != ji++)
    {
        
PlantInfo[i][plantID] = db_get_field_assoc_int(dbresult"id");
        
PlantInfo[i][plantType] = db_get_field_assoc_int(dbresult"type");
        
PlantInfo[i][plantDrugs] = db_get_field_assoc_int(dbresult"drugs");
        
PlantInfo[i][plantPos][0] = db_get_field_assoc_float(dbresult"x");
        
PlantInfo[i][plantPos][1] = db_get_field_assoc_float(dbresult"y");
        
PlantInfo[i][plantPos][2] = db_get_field_assoc_float(dbresult"z");
        
PlantInfo[i][plantPos][3] = db_get_field_assoc_float(dbresult"a");
        
PlantInfo[i][plantInterior] = db_get_field_assoc_int(dbresult"interior");
        
PlantInfo[i][plantWorld] = db_get_field_assoc_int(dbresult"world");
        
PlantInfo[i][plantExists] = true;
        
ServerInfo[total_plants]++;
        
Plant_Refresh(i);
        
db_next_row(dbresult)
    }
    
db_free_result(dbresult);

As for the initial issue, I took a look at your code but didn't notice anything. Debug it as:
pawn Код:
// loading plants

// print message

// loading dealership

// print message

// loading dealership vehicles

// print message

// and so on..
Reply


Messages In This Thread
db_get_field_assoc - by JaKe Elite - 11.10.2016, 08:38
Re: db_get_field_assoc - by Konstantinos - 11.10.2016, 08:49
Re: db_get_field_assoc - by JaKe Elite - 11.10.2016, 08:52
Re: db_get_field_assoc - by Konstantinos - 11.10.2016, 09:07
Re: db_get_field_assoc - by JaKe Elite - 11.10.2016, 09:39
Re: db_get_field_assoc - by Konstantinos - 11.10.2016, 09:51
Re: db_get_field_assoc - by JaKe Elite - 11.10.2016, 09:55
Re: db_get_field_assoc - by JaKe Elite - 11.10.2016, 10:07
Re: db_get_field_assoc - by JaKe Elite - 26.01.2018, 22:34
Re: db_get_field_assoc - by JaKe Elite - 27.01.2018, 05:49

Forum Jump:


Users browsing this thread: 1 Guest(s)