I used php template of overthemike (php-templates), but it does not work with function while (on mysql)...
Display the correct category:
1.PC 1.Power 2.VGA 3.RAM 4.Audio 2.Laptop 1.Monitor 2.Pin 3.Keyboard
After running:
1.PC 3.Power 4.VGA 5.RAM 6.Audio 7.Monitor 8.Pin 9.Keyboard 2.Laptop 3.Power 4.VGA 5.RAM 6.Audio 7.Monitor 8.Pin 9.Keyboard
Example: http://www.mediafire.com/?fln71mh5pwqjn7m
Why does a code fill all the space available to it?
Can you help me fix this code?
$data = array();
while($result = mysql_fetch_array($query))
{
$sql = mysql_query("SELECT * FROM category WHERE sub = ".$result["id"]." ORDER BY id ASC");
while($resub = mysql_fetch_array($sql))
{
$data[$result["title"]][] = array(
"id"=>$resub["id"],
"title"=>$resub["title"],
);
}
}
print_r($data);
This should work. Also I think that you should use something else because this is not good solution for what you want to achieve.