I have an array which is decalred thus:
for($x=0;$x<mssql_num_rows($result);$x++){
$this->topOrderedParts[$x] = mssql_fetch_array($result,MSSQL_ASSOC);
}
to access the elements i have to:
$loop = 0;
$counter=0;
while($counter < 10){
if(eregi($category,$this->topOrderedParts[$loop]['ID'])){
echo "<tr><td align=middle width=10%>".($counter+1)."</td><td width=20% class=partlistid>".$this->topOrderedParts[$loop]['ID']."</td><td class=partlistdesc>".$this->topOrderedParts[$loop]['DESCRIPTION']."</td></tr>";
$counter++;
}
$loop++;
}
This second piece of code times out after 3 mins when $category is set to certain values.
the array $this->topOrderedParts, is basically an array of partcodes and their relevant description. They are ordered by a the number of most 'ordered' parts according to our sales orders, this value doesnt need to be stored in the array.
The second set of code outputs 10 (if there are ten) parts that have the $category in the ['id'] part of the array. Basicallly i dont think my routine is very efficient and was wondering whether there is a variant to what i am trying to do.
There could be around 300 items in $this->topOrderedParts.
Thanx in advance