Hello,
I am trying to store a single MYSQL result into a 2 dimensional array, for example I would like to end up with something like this:
array[0][0] = result[0] , array[0][1] = result[1] , array[0][2] = result[2] .....
Here is my code:
$tempCat = array();
for ($i=0;$i<$numcat;$i++)
{
$result = mysql_query("SELECT * FROM accs_subcat WHERE category='$cat2[$i]'");
$j=0;
while($row = mysql_fetch_array($result))
{
$tempCat[$i][$j] = $row['subcat'];
$j++;
}
}
//to display results
for ($i=0;$i<$numcat;$i++)
{
$tempnum = count ($tempCat[$i]);
for($j=0;$j<$tempnum;$j++)
{
echo "$tempCat[$i][$j]";
}
}
Any help with this would be very much appreciated, thank-you.