how to display the information in php of two different table

this code displays the both the information of the table
just want to display oly one table information which i select

as there are two tables menus and nonmenus.

and in those 2 tables n number of fields and items are given as input
so when i select one item of a table oly the information of those items are to be displayed

as it displays both the table information when i select a particular item of a table.

can any try n help..

<?php
session_start();
if(isset($_GET['id']))
{
    $_SESSION['n']=$_GET['id'];
}

$n=$_SESSION['n'];

$con=mysql_connect("localhost","root","");
mysql_select_db("menu",$con);
$sql="select * from menus where id=$n";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
echo "<table border=0 width=100%  ><tr>";
echo "<td><h1><img src=\"images/veg.jpg\" height=35 width=35  /> $row[tittle]</h1></td>"; ?> 
<?php echo" <td><h1><img src=\"images/telephone1.jpg\" height=35 width=35  /> $row[phone]    </h1></td>";
//<img src="images/Kapu-Lighthouse.jpg"  title="Non veg" width="210" height="150" />

//echo " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br>";
// echo "- $row[phone]"; 
echo "</tr></table>";
?> 
    <img src="upload/<?php  echo $row['photo'];?>" height=300 width= 550 alt="" />
    <?php
echo "<br> <a href=index.php>back</a>";


?>                    

   <?php
    echo"<h4>$row[address]</h4>";
   ?>          
<h1>Gallery</h1>

<table  border=7  cellspacing=10 > <tr>

<td><img src="upload/<?php  echo $row['gallery'];?>" height=150 width= 160 alt="" /> </td>
  <td><img src="upload/<?php  echo $row['gallery1'];?>"height=150 width= 160 /> </td>
  <td><img src="upload/<?php  echo $row['gallery2'];?>"height=150 width= 160 /> </td>
  <td><img src="upload/<?php  echo $row['gallery3'];?>"height=150 width= 160 /> </td>
  <td><img src="upload/<?php  echo $row['gallery4'];?>"height=150 width= 160 /> </td>
</tr>
</table>
<?php mysql_close($con);   ?>
<!-- End veg items to be displayed in menu.php -->


 <!-- Non veg items to be displayed in menu.php -->
         <?php



                    if(isset($_GET['nid']))

{
    $_SESSION['n']=$_GET['nid'];
}

$n=$_SESSION['n'];


$con=mysql_connect("localhost","root","");
mysql_select_db("menu",$con);
$sql="select * from nonmenu where id=$n";
echo "$sql";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);

echo "<table border=0 width=100%  ><tr>";
echo "<td><h1><img src=\"images/non-veg.jpg\" height=35 width=35  /> $row[ntittle]</h1></td>"; ?> 
<?php echo" <td><h1><img src=\"images/telephone1.jpg\" height=35 width=35  /> $row[nphone]    </h1></td>";
//<img src="images/Kapu-Lighthouse.jpg"  title="Non veg" width="210" height="150" />

//echo " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br>";
// echo "- $row[phone]"; 
echo "</tr></table>";
?> 
    <img src="upload/<?php  echo $row['nphoto'];?>" height=300 width= 550 alt="" />
    <?php
echo "<br> <a href=index.php>back</a>";


?>                    

   <?php
    echo"<h4>$row[naddress]</h4>";
   ?>          
<h1>Gallery</h1>

<table  border=7  cellspacing=10 > <tr>

<td><img src="upload/<?php  echo $row['ngallery'];?>" height=150 width= 160 alt="" /> </td>
  <td><img src="upload/<?php  echo $row['ngallery1'];?>"height=150 width= 160 /> </td>
  <td><img src="upload/<?php  echo $row['ngallery2'];?>"height=150 width= 160 /> </td>
  <td><img src="upload/<?php  echo $row['ngallery3'];?>"height=150 width= 160 /> </td>
  <td><img src="upload/<?php  echo $row['ngallery4'];?>"height=150 width= 160 /> </td>
</tr>
</table>
<?php mysql_close($con); ?>
<!-- End Non veg items to be displayed in menu.php -->




        </div>
    </div>

Leave a Reply

*

Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories