05.02.2013, 10:32
Код:
new car_id[20], name[20], price[20], result[200], count;
mysql_query("SELECT car_id, name, price FROM `cars` WHERE shop = '2' ORDER BY `price` ASC");
mysql_store_result();
while(mysql_fetch_row_format(result)){
sscanf(result, "p<|>is[40]i", car_id[count], name[count], price[count]);
count++;
}
mysql_free_result();
Код:
new test[100]; format(test,sizeof(test),"%d %s %d",car_id[0],name[0],price[0]); SendClientMessage(playerid, GREEN, test);
It should print: "451 Turismo 123428"
Код:
new test2[100]; format(test,sizeof(test2),"%d %s %d",car_id[1],name[1],price[1]); SendClientMessage(playerid, GREEN, test2);
Im in to pawn programming for about a week now and can't figure this out.
Im sure it's some silly mistake, please help me

Also it would be nice to know if anyone figured a way to fetch unknown number of mysql rows to array without specifying index(something like dynamic array).Maybe there's a workaround or something...

