PDA

View Full Version : Array size


klimgorilla
16/04/2014, 08:30 PM
Hey guys,

I'm trying to connect my sa-mp project with my PHP management system but i've some problems with array sizes.

This is how I create my array to store goods for a truck mission.

new TS_Goods[][32];


Then I fill the array with data from the database. So far so good but I'll never get the size of the array since I didn't define it.

good = random(?);


A simple solution would be to store the SQL num rows into a variable to use it later on. But this solution feels wrong.

good = random(SQL_num_rows);

Do you guys have any other ideas?

EDIT:

So I've used the simple solution and it works quite well. Adding these variables might use more memory but it doesn't leave any empty slots in the arrays.