I have two tables in a database, sight_country
and sightseeing
. I am inserting the ID of the country field from the sight_country
table to s_country
field of the table sightseeing
. In php I am showing country field values from sight_country
in a CSS drop-down menubar.
the code is
<li class="menu-item-has-children"><a href="#">Sightseeing</a>
<ul class="sub-menu">
<?php
$qry_st = "select * from `sight_country` limit 5";
$rec_st = mysql_query($qry_st );
if( mysql_num_rows($rec_st) > 0)
{
while($res_st = mysql_fetch_array($rec_st))
{
echo "<li><a href='sightseeing.php?id=$res_st[id]'>".$res_st['country']."</a></li>";
}
}
?>
</ul>
</li>
When click on link of county value then I am showing all sightseeing data from the table sightseeing in php page.
the code is
$sql = "select * from `sightseeing` where `s_country` ='$id'";
$res = mysql_query($sql);
$rec = mysql_fetch_array($res);
the country may have two or more related sightseeing data, so I am displaying sightseeing titles from the sightseeing table in a sidebar menu in my PHP page.
the code is
<ul class="st_lnks">
<?php
$qry_st = "select * from `sightseeing` where s_country = '$id'";
$rec_st = mysql_query($qry_st );
if( mysql_num_rows($rec_st) > 0)
{
while($res_st = mysql_fetch_array($rec_st))
{
echo "<li><a href='sightseeing.php?id=$res_st[s_country]'>".$res_st['stitle']."</a></li>";
}
}
?>
</ul>
when I click link of stitle I want to show it's related sightseeing data in same page. How it can be done?