05.09.2010, 07:32
pawn Code:
mysql_fetch_field_row(PickupInfo[idx][puMessage], "message");
pawn Code:
stock LoadSQLPickups()
{
new
x,
totalPickups,
resultString[64]; // Increase if needed.
mysql_query("SELECT * FROM pickups");
mysql_store_result();
totalPickups = mysql_num_rows();
while(mysql_retrieve_row()) {
mysql_get_field("id", result);
x = strval(result);
mysql_get_field("message", PickupInfo[x][puMessage]);
mysql_get_field("type", result);
PickupInfo[x][puType] = strval(result);
mysql_get_field("model", result);
PickupInfo[idx][puModel] = strval(result);
mysql_get_field("x", result);
PickupInfo[idx][puX] = floatstr(result);
mysql_get_field("y", result);
PickupInfo[idx][puY] = floatstr(result);
mysql_get_field("z", result);
PickupInfo[idx][puZ] = floatstr(result);
CreatePickup(PickupInfo[x][puModel], PickupInfo[x][puType], PickupInfo[x][puX], PickupInfo[x][puY], PickupInfo[x][puZ]);
}
mysql_free_result();
return printf("%d pickups loaded from DB", totalPickups);
}