MySQL load problems
#1

hello,

here is the code I use to load the cars (you can read my problem down)

new query[150],idx = 1,string[150];
mysql_query("SELECT * FROM Autohaus");
mysql_store_result();
new j = mysql_num_rows();
while(idx <= j+1)
{
format(query,sizeof query,"SELECT * FROM Autohaus WHERE ID = %d",idx);
mysql_query(query);
mysql_store_result();
DestroyVehicle(AhCars[idx][vID]);
while(mysql_fetch_row(query))
sscanf(query,"e<p<|>dddddffff>",AhCars[idx]);
AhCars[idx][vID] = AddStaticVehicleEx(AhCars[idx][Modell],AhCars[idx][PosX],AhCars[idx][PosY],AhCars[idx][PosZ],AhCars[idx][Rotation],1,0,3600000);
format(string,sizeof string,"Autohaus %d",AhCars[idx][vID]);
SetVehicleNumberPlate(AhCars[idx][vID],string);
format(string,sizeof string,"Modell: {FF0000}%s\n{00A0FF}Kaufpreis: %iЂ\nVerkaufspreis: %iЂ\nRepairpreis: %iЂ",Carname[AhCars[idx][Modell]-400],AhCars[idx][Kaufpreis],AhCars[idx][Verkaufspreis],AhCars[idx][Repairpreis]);
AhCars[idx][DreiDText] = Create3DTextLabel(string,hellblau,AhCars[idx][PosX],AhCars[idx][PosY],AhCars[idx][PosZ]+0.75,15,0);
Attach3DTextLabelToVehicle(AhCars[idx][DreiDText],AhCars[idx][vID],0,0,0.75);
idx++;
}

I've following problem:

it doesn't load any vehicles over a non-existing id.
e.g. it loads id 1 and 2 but there is still id 5 but it wasn't loaded because id 3 doesn't exist.
So my question is: how can I solve the problem without always changing the table entry?

Thanks to all for their help

Aikochan
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)