0

1.Category
2.Category_sub
note: category_name field in Category_sub table is im using as category_id hope u get after see d snap shot

i want to do
in my category_sub table i am storing category_id frm category table i am attacting the screen shot of table..

i want when i click on Business ..the page ll open which contain the subcategory of bussiness only(im calling that page in iframe by giving target of that page in link)..this also im able to do but the way im doing is very lengthy and i feel there is a better way

because i need to make seprate page for every category so if i have 20 category so i need to make 20 pages for that....the query im applying have error i think..:( please help me

(the main page in which iframe  i m using)

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script>
<script type="text/javascript">

$(document).ready(function(){

        //$(".sub_menu").hide();
        //$(".show_hide").show();

     /*$('.slidingDiv').click(function(){
     $(".sub_menu").slideToggle();
     $(".show_hide").show()*/;


});
</script>

  <script language="javascript" type="text/javascript">
function resizeIframe(obj)
{
 obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
 obj.style.width = obj.contentWindow.document.body.scrollWidth + 'px';                       
}
</script>



<?php
session_start();
include("connection.php");
$category_name="";
$subcategory_name="";


$query1= "SELECT * from `category`";
$result5 = mysql_query($query1);
$row = mysql_fetch_array($result5);
$category_name = $row['category_name'];

$query2= "SELECT * from `category_sub`";
$result2 = mysql_query($query2);
$row = mysql_fetch_array($result2);
$subcategory_name=$row['subcatogory_name'];
?>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hedgeis-Markets</title>
<link href="market css.css" rel="stylesheet" type="text/css" />



</head>

<body>

<?php include('header2.php');?>
<!--contant start-->
<div class="Contant_wrapper clearfix">
 <div class="topdiv">
        <div class="view">
        <ul>
        <li>View</li>
        <li><a href="#">latest</a></li>
        <li><a href="#">Current Prices</a></li>
        <li> <a href="#">Charts</a></li>
        </ul>
        </div>
    </div>

    <!--contant_left start-->
    <div class="contant_left">

        <div class="menu_item">
        <a href="#">Most Active Today </a>
        <div class="sub_menu">
        </div>
        </div>

        <div class="menu_item">
            <?php
          $query1= "SELECT * from `category` where category_id='1'";
          $result5 = mysql_query($query1);
           while($row1=mysql_fetch_array($result5))


           {

          $cate_name=$row1['category_name'];


     $cate_id=$row1['category_id'];

  ?> 
       <a href="category_page.php?cate_id=<?php echo $cate_id?>"  target="frmname">
        <?php echo"$cate_name";?></a>
       <!-- <a href="#">Business </a> -->
       <?php } ?> 

 <div class="sub_menu" class="show_hide">
  <?php
                $id="";
                if(isset($_GET['cate_id']))
                {
                $id=$_GET['cate_id'];
                echo $id;
               //  //$subcategory_name=$_POST['subcatogory_name'];
                }

        $query3= "SELECT * from `category_sub` where `category_name`='$id'"; 

          $res = mysql_query($query3);
           while($row2=mysql_fetch_array($res))
            {

              $sub_name=$row2['subcatogory_name'];

                 ?>

            <ul>
               <li class="show_hide"><a href="#"><?php echo $sub_name ;?></a></li>
            </ul>
               <?php } ?> 
            </div>
       <!--  </div>  -->

          <div class="menu_item">
              <?php
          $query2= "SELECT * from `category` where category_id='2'";
          $result2 = mysql_query($query2);
           while($row2=mysql_fetch_array($result2))


           {

          $cate_name=$row2['category_name'];


     $cate_id=$row1['category_id'];

  ?>
        <a href="category_page.php?cate_id=<?php echo $cate_id?>"  target="frmname">
        <?php echo"$cate_name";?></a>
       <?php } ?> 

<div class="sub_menu">
<ul>
                 <?php
               $id="";
               if(isset($_GET['cate_id']))
               {
                $id=$_GET['cate_id'];
                echo $id;
                //$subcategory_name=$_POST['subcatogory_name'];
               }

        $querya= "SELECT * from `category_sub` where `category_name`='2'"; 

          $resa = mysql_query($querya);
           while($row3=mysql_fetch_array($resa))
            {

              $sub_name=$row3['subcatogory_name'];

                 ?>

            <ul>
               <li><a href="#"><?php echo $sub_name ;?></a></li>
            </ul>
               <?php } ?> 
                </div>
        </div>

        <div class="menu_item">
            <?php
          $queryb= "SELECT * from `category` where category_id='3'";
          $resultb = mysql_query($queryb);
           while($row4=mysql_fetch_array($resultb))


           {

          $cate_name=$row4['category_name'];


     $cate_id=$row1['category_id'];

  ?>
         <a href="category_page.php?cate_id=<?php echo $cate_id?>"  target="frmname">
        <?php echo"$cate_name";?></a>
       <?php } ?>  </div>
         <!-- <a href="#">Construction & Engineering</a> -->
<div class="sub_menu">
<ul>
       <?php
               $id="";
               if(isset($_GET['cate_id']))
               {
                $id=$_GET['cate_id'];
                echo $id;
                //$subcategory_name=$_POST['subcatogory_name'];
               }

        $queryc= "SELECT * from `category_sub` where `category_name`='3'"; 

          $resc = mysql_query($queryc);
           while($row6=mysql_fetch_array($resc))
            {

              $sub_name=$row6['subcatogory_name'];

                 ?>

         <ul>
               <li><a href="#"><?php echo $sub_name ;?></a></li>
            </ul>
               <?php } ?> 
                </div>
       <!--  </div> -->

       <!-- <div class="menu_item">
         <a href="#">Current Events</a>
<div class="sub_menu">
<ul>
                    <li><a href="#">Taiwan</a></li>
                   <li><a href="#">Sponsors of Terror</a></li>
                   <li><a href="#">Japan </a></li>
                </ul>
                </div>
        </div>

        <div class="menu_item">
         <a href="#">Entertainment</a>
<div class="sub_menu">
<ul>
                   <li><a href="#">Box Office Returns</a></li>
                   <li><a href="#">Academy Awards</a></li>
                </ul>
                </div>
        </div>

         <div class="menu_item">
         <a href="#">Financial</a>
<div class="sub_menu">
<ul>
                   <li><a href="#">Dow Jones Index</a></li>
                   <li><a href="#">FTSE 100 Index</a></li>
                  <li><a href="#"> US Eco Numbers </a></li>
                  <li><a href="#"> Company IPOs </a></li>
                  <li><a href="#"> Eurozone Crisis </a></li>
                </ul>
                </div>
        </div>

        <div class="menu_item">
         <a href="#">Foreign Affairs</a>
<div class="sub_menu">
<ul>
                   <li><a href="#">Middle East Protests</a></li>
                   <li><a href="#">Iran</a></li>
                  <li><a href="#"> Terrorism </a></li>            
                </ul>
                </div>
        </div>

        <div class="menu_item">
         <a href="#">Legal</a>
<div class="sub_menu">
<ul>
                   <li><a href="#">Supreme Court</a></li>
                   <li><a href="#">US Healthcare Reform</a></li>     
                </ul>
                </div>
        </div>

         <div class="menu_item">
         <a href="#">Politics</a>
<div class="sub_menu">
<ul>
                   <li><a href="#">Obama Administration</a></li>
                   <li><a href="#">UK Politics</a></li>     
                </ul>
                </div>
        </div>

        <div class="menu_item">
        <a href="#">Real Estate</a>
<div class="sub_menu">
<ul>
                   <li><a href="#">Canadian Real Estate</a></li>                                                    </ul>
                </div>
        </div>


          <div class="menu_item">
        <a href="#">Scientific</a>
<div class="sub_menu">
<ul>
                   <li><a href="#">Focus Fusion</a></li>                                                    </ul>
                </div>
        </div>

          <div class="menu_item">
        <a href="#">Social and Civil</a>
<div class="sub_menu">
<ul>
                   <li><a href="#">Focus Fusion</a></li>                                                    </ul>
                </div>-->
        </div>

     </div>
    <!--contant_left end--> 

 <!--contant_right start   -->
    <div class="contant_right clearfix">
            <iframe allowtransparency=true frameborder=0 id=rf sandbox="allow-same-origin allow-forms 

allow-scripts"  name="frmname" scrolling=auto src="market_internal_pages.php"   onload='javascript:resizeIframe(this);'

 style="width:100%; height:auto;"></iframe>








    </div>
   <!--  <div class="contant_right clearfix">
        <iframe allowtransparency=true frameborder=0 id=rf sandbox="allow-same-origin allow-forms 

allow-scripts" scrolling=auto src=".php" 

style="width:100%;height:100%"></iframe>
    </div> -->
 <!--contant_right start end -->

</div>
<div style="clear:both"></div>
<?php include('footer1.php');?>
<!--contant end-->
</body>
</html>




<?php
session_start();
include("connection.php");

$category_name="";
//$subcategory_name="";
$description="";
$event="";
$file ="";
$date="";
$category_id="";

//$id=$_REQUEST['id'];


$_SESSION['description']=$description;
$_SESSION['event']=$event;
$_SESSION['category_name']=$category_name;

/*$query1= "SELECT * from `category_sub`";

$result = mysql_query($query1);

$row = mysql_fetch_array($result);
$category_name = $row['category_name'];
$description = $row['description'];
$event=$row['event'];
$image=$row['image'];
*/
?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hedges-Markets</title>
<link href="marnet_internal_css.css" rel="stylesheet" type="text/css" />
</head>

<body>


<!--contant start-->
<div class="Contant clearfix">
    <div class="heading">
      Most Active <span class="heading_sub">(10 Market)</span>
    </div>

   <!-- field start-->
     <div class="field clearfix">
        <?php 
$id="";
   if(isset($_GET['cate_id']))
 {
     $id=$_GET['cate_id'];
     echo $id;
  //               //$subcategory_name=$_POST['subcatogory_name'];
   }
$query_1= "SELECT * from `category_sub` where `category_name`='$id'";
echo $query_1;
$result_1 = mysql_query($query_1);

//$row = mysql_fetch_array($result);
//$result1=mysql_query($);
     while($row1=mysql_fetch_array($result_1))
{ 
      $url1=$row1['image'];
      $cate_name1=$row1['category_name'];
      $des1=$row1['description'];
      $eve1=$row1['event'];



  ?>  


  <div class="images">   
        <img src="cat_image/<?php echo $url1; ?>" width="90px" height="90px"></div>
        <div class="information"> 
        <h3><a href="#">Description:<?php echo "$des1";?></br></a></h3> 
        Event:<a href="#">Event:<?php echo "$eve1";?></a></div>
       <div class="rating">
       </div>
        <?php } ?> 
    </div>







        <!--<div class="images">
        </div>
        <div class="information"> 
        <h3><a href="#">Lincoln to win Academy Award for Best Picture</a></h3> 
        Event:<a href="#"> Academy Award for Best Picture (open to sensible suggesti...</a></div>
       <div class="rating">
       </div>

    </div> -->
 <!-- field end-->


 <!-- field start-->
    <!-- <div class="field clearfix">

        <div class="images">
        </div>
        <div class="information"> 
        <h3><a href="#">Lincoln to win Academy Award for Best Picture</a></h3> 
        Event:<a href="#"> Academy Award for Best Picture (open to sensible suggesti...</a></div>
       <div class="rating">
       </div>

    </div> -->
 <!-- field end-->

 <!-- field start-->
    <!-- <div class="field clearfix">

        <div class="images">
        </div>
        <div class="information"> 
        <h3><a href="#">Lincoln to win Academy Award for Best Picture</a></h3> 
        Event:<a href="#"> Academy Award for Best Picture (open to sensible suggesti...</a></div>
       <div class="rating">
       </div>

    </div> -->
 <!-- field end-->




</div>
<!--contant end-->
</body>
</html>
Attachments category_sub.png 191.8 KB
1
Contributor
1
Reply
3
Views
4 Years
Discussion Span
Last Post by neha05
0

$query_1= "SELECT * from category_sub where category_name='1'";
$query_1= "SELECT * from category_sub where category_name='2";
$query_1= "SELECT * from category_sub where category_name='3'";

if iam giving manually diffrent id's den it showing diff records
if i am doing in following way
$query_1= "SELECT * from category_sub where category_name='$id'";
its only showing id =1 information

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.