hey all
i stuck with this, i spent 3 hours of internet search but didnt find solution.
i want to make a navigation like
nokia
nokia N95
nokia E71
samsung
samsung D500
D900
Sony Erricson
w110
p10
i made 2 tables , phone, model
phone > id, name
model > id, name, phoneid
i tried this query in php
select phone.id, phone.name, model.id, model.name, model.phoneid from phone, model where model.phoneid= phone.id
it shows
nokia
nokia N95
nokia
nokia E71
nokia
some model
nokia
some model
samsung
samsung D500
samsung
D900
and soo on
if i use
$query= "select * from phone";
$result = mysql_query($query);
while ($row= mysql_fetch_array($result))
{
$id =$row['id'];
$phone= $row['name'];
echo "<h1>$phone</h1>";
echo "<ul>";
//[b]2nd while loop[/b]
$query2= "select * from model where phoneid='$id'";
$result2 = mysql_query($query2);
while ($row= mysql_fetch_array($result2))
{
$model= $row['name'];
echo "<li>$phone</li>";
}
echo "</ul>";
this code just fetch one result
nokia
nokia n95
please help me , i shall be greatful.