<?php
ob_start();
session_start(); 
include ('database_connection.php');

if (isset($_SESSION['myusername'])) {

$logout = '<li><a href="logout.php">Logout</a></li>';



} 


?>

<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <title>MVRAM</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
 <!-- Le styles -->
    <link href="bootstrap/css/bootstrap.css" rel="stylesheet">
    <link id="switch_style" href="bootstrap/css/united/bootstrap.css" rel="stylesheet">
    <link href="css/main.css" rel="stylesheet">
    <link href="css/jquery.rating.css" rel="stylesheet">



</head>


<body>

    <div class="container">
        <div class="row"><!-- start header -->
            <div class="span4">
            <a href="index.php">
                <img src = "pictures/pages/newlogo.png"
         alt = "newlogo" />
            </a>
            </div>
            <div class="span8">

                <div class="row">
                    <div class="span1">&nbsp;</div>
                    <div class="span2">

                    </div>
                    <div class="span2">

                    </div>                   
                    <div class="span3 customer_service">
                        </div>
                </div>
                <br />
                <div class="row">
                    <div class="links pull-right">

                    </div>

                </div>
            </div>
        </div><!-- end header -->

        <div class="row"><!-- start nav -->
            <div class="span12">
              <div class="navbar">
                    <div class="navbar-inner">
                      <div class="container" style="width: auto;">
                        <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                          <span class="icon-bar"></span>

                          <span class="icon-bar"></span>
                          <span class="icon-bar"></span>
                        </a>
                        <div class="nav-collapse">
                          <ul class="nav">
                            <li><a href="index.php">Home</a></li>
                            <li><a href="myaccount.php">My Account</a></li>
                            <li><a href="cart.php">Shopping Cart</a></li>
                            <li><a href="aboutus.php">About Us</a></li>
                             <li><a href="contactus.php">Contact</a></li>
                             <?php echo $logout; ?>

                          </ul>

                          <ul class="nav pull-right">
                           <li class="divider-vertical"></li>
                            <form class="navbar-search" method="post" action="searchresult.php">
                                <input type="text" class="search-query span2" id="keyword" name="keyword" 

placeholder="Search">
                                <button class="btn btn-primary btn-small search_btn" 

type="submit">Go</button>
                            </form>

                          </ul>
                        </div><!-- /.nav-collapse -->
                      </div>
                    </div><!-- /navbar-inner -->
                </div><!-- /navbar -->
            </div>
        </div><!-- end nav -->     

        <div class="row">
        <div class="span3">







            <!-- start sidebar -->
<ul class="breadcrumb">
    <li>Categories</span></li>
</ul>
<div class="span3 product_list">
              <ul>



              <?php






                                $qry="SELECT c.categoryID,c.categoryname, count(*) as nb 
from tbl_categories c, tbl_product p WHERE c.categoryID=p.categoryID and availability='Available' GROUP BY  c.categoryID,c.categoryname";
                                $sql=mysql_query($qry);

                                while($obj=mysql_fetch_object($sql))
                                {


                        ?>
                <li><a class="active" href="category.php?categoryID=<?php echo $obj->categoryID; ?>"> <? echo $obj->categoryname,' (',$obj->nb,')'; ?></a> 

                    <?php  $qry1="Select c.subcategoryID, c.subcategoryname, c.categoryID, count(*) as nbs from tbl_subcategories c, tbl_product 

p where c.subcategoryID=p.subcategoryID AND c.categoryID=".$obj->categoryID." and availability='Available' Group by c.subcategoryID, c.subcategoryname";
                                $sql1=mysql_query($qry1);
                        while($ob=mysql_fetch_object($sql1))
                                {?>
                  <ul>
                &nbsp;<a href="subcategory.php?subcategoryID=<?php echo $ob->subcategoryID; ?>"><? echo $ob->subcategoryname,' (',$ob->nbs,')'; ?></a>

              </ul></li>
                <?php  }?><?php}?>


               </ul>

    <ul class="nav">

    </ul>
</div><!-- end sidebar -->

        </div>
         <div class="span9">


            <div id="myCarousel" class="carousel slide">
    <div class="carousel-inner">
    <?php 
    $for = "banner";
    $qr=  mysql_query("select * from tbl_pages where `for` ='$for'");
$count = 0;
    while($obj=  mysql_fetch_object($qr))
    {?>
  <div class="item <?php if($count==0) echo 'active';?>">
  <img src="<?php echo $obj->image;?>" alt="">   <!-- Echo Picture -->
    <div class="carousel-caption">
    <h4><?php echo $obj->title; ?></h4>   <!-- echo Title -->
    <p><?php echo $obj->text; ?></p> <!-- echo Description -->
    </div>

    </div>

  <?php   
$count++;
}
?>

    </div>

    <a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>
    <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>
    </div>
    </div>





        <div class="span7 popular_products">
         <h2>News</h2><br />
        <div class="row">

        <?php
    /*
        Place code to connect to your DB here.
    */
        // include your code to connect to DB.

    $tbl_name="tbl_news";       //your table name
     // How many adjacent pages should be shown on each side?
  $adjacents = 3;

  /* 
     First get total number of rows in data table. 
     If you have a WHERE clause in your query, make sure you mirror it here.
  */
  $query = "SELECT COUNT(*) FROM $tbl_name";
  $total_items = mysql_fetch_array(mysql_query($query));

  /* Setup vars for query. */
  $targetpage = "index.php";   //your file name  (the name of this file)
  $limit = 4;                 //how many items to show per page
  if(isset($_GET['page'])) {
    $page = $_GET['page'];
    $start = ($page - 1) * $limit;      //first item to display on this page
  } else {
    $page = 0;
    $start = 0;               //if no page var is given, set start to 0
  }

  /* Get data. */
  $sql = "SELECT newsID, title, post, author, date, time as sd FROM tbl_news Order By newsID DESC LIMIT $start, $limit";
  $result = mysql_query($sql);

  /* Setup page vars for display. */
  if ($page == 0) $page = 1;          //if no page var is given, default to 1.
  $prev = $page - 1;              //previous page is page - 1
  $next = $page + 1;              //next page is page + 1
  $lastpage = ceil($total_items[0]/$limit);    //lastpage is = total pages / items per page, rounded up.
  $lpm1 = $lastpage - 1;            //last page minus 1

  /* 
    Now we apply our rules and draw the pagination object. 
    We're actually saving the code to a variable in case we want to draw it more than once.
  */
  $pagination = "";
  if($lastpage > 1)
  { 
    $pagination .= "<div class=\"pagination pagination-centered\"><ul>";
    //previous button
    if ($page > 1) 
      $pagination.= "<li><a href=\"$targetpage?page=$prev\">previous</a></li>";
    else
      $pagination.= "<li class=\"disabled\"><a href=\"#\">previous</a></li>"; 

    //pages 
    if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up
    { 
      for ($counter = 1; $counter <= $lastpage; $counter++)
      {
        if ($counter == $page)
          $pagination.= "<li class=\"active\"><a href=\"#\">$counter</a></li>";
        else
          $pagination.= "<li><a href=\"$targetpage?page=$counter\">$counter</a></li>";         
      }
    }
    elseif($lastpage > 5 + ($adjacents * 2))  //enough pages to hide some
    {
      //close to beginning; only hide later pages
      if($page < 1 + ($adjacents * 2))    
      {
        for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
        {
          if ($counter == $page)
            $pagination.= "<li class=\"active\"><a href=\"#\">$counter</a></li>";
          else
            $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";         
        }
        $pagination.= "<a href=\"#\">...</a>";
        $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
        $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>";   
      }
      //in middle; hide some front and some back
      elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
      {
        $pagination.= "<a href=\"$targetpage?page=1\">1</a>";
        $pagination.= "<a href=\"$targetpage?page=2\">2</a>";
        $pagination.= "<a href=\"#\">...</a>";
        for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
        {
          if ($counter == $page)
            $pagination.= "<li class=\"active\"><a href=\"#\">$counter</a></li>";
          else
            $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";         
        }
        $pagination.= "<a href=\"#\">...</a>";
        $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
        $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>";   
      }
      //close to end; only hide early pages
      else
      {
        $pagination.= "<a href=\"$targetpage?page=1\">1</a>";
        $pagination.= "<a href=\"$targetpage?page=2\">2</a>";
        $pagination.= "<a href=\"#\">...</a>";
        for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
        {
          if ($counter == $page)
            $pagination.= "<li class=\"active\"><a href=\"#\">$counter</a></li>";
          else
            $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";         
        }
      }
    }

    //next button
    if ($page < $counter - 1) 
      $pagination.= "<a href=\"$targetpage?page=$next\">next</a>";
    else
      $pagination.= "<li class=\"disabled\"><a href=\"#\">next</a></li>";
    $pagination.= "</ul></div>\n";   
  }

      ////News Section

if ($result) {
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<h5>'.$row['title'].'</h5>'.$row['post'].'<br />
<h5>Posted by : <b>'.$row['author'].'</b> &nbsp '.$row['date'].' &nbsp '.$row['sd'].'</h5><br />';
}
} else {
echo 'There are no news posts to display';
}


       ?> 



        <div class="pagination">
  <?php echo $pagination; ?>
    </div>

        </div>





        </div>
        <div class="span2">

         <div class="roe">
        <h2>Newsletter</h2><br />
        <p>Sign up for our weekly newsletter and stay up-to-date with the latest offers, and newest products.</p>

            <form class="form-search"  method="post" name="newsletter" action="subscribenewsletter.php">
    <input type="text" name="email"  class="span2" placeholder="Enter your email" /><br /><br />
    <button  name="submit" type="submit" class="btn btn-primary pull-right">Subscribe</button>
    </form>
        </div>











        <br /><br />
            <a href="#"><img alt="" title="" src="css/images/paypal_mc_visa_amex_disc_150x139.gif" /></a>
            <a href="#"><img alt="" src="css/images/bnr_nowAccepting_150x60.gif" /></a>

        </div>

      </div>

      <footer>
    <hr />
    <div class="row well no_margin_left">

<div class="span3">
        <h4></h4>
        <ul>

        </ul>
    </div>

    <div class="span3">
        <h4>Information</h4>
        <ul>
            <li><a href="aboutus.php">About Us</a></li>
            <li><a href="services.php">Services</a></li>
            <li><a href="contactus.php">Contact Us</a></li>
        </ul>
    </div>


    <div class="span2">
        <h4>My Account</h4>
        <ul>
            <li><a href="myaccount.php">My Account</a></li>
            <li><a href="myorder.php">Order History</a></li>
        </ul>
    </div>

</footer>

</div> <!-- /container -->



<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
<script src="js/jquery.rating.pack.js"></script>


</body>


</html>

i have problem at the end of html tag please help me

I don't know if this solves the problem but the following footer is started outside the div while it ends inside the div:

<footer>
    <hr />
    <div class="row well no_margin_left">
        <div class="span3">
            <h4></h4>
            <ul>
            </ul>
        </div>
        <div class="span3">
            <h4>Information</h4>
            <ul>
                <li><a href="aboutus.php">About Us</a></li>
                <li><a href="services.php">Services</a></li>
                <li><a href="contactus.php">Contact Us</a></li>
            </ul>
        </div>
        <div class="span2">
            <h4>My Account</h4>
            <ul>
                <li><a href="myaccount.php">My Account</a></li>
                <li><a href="myorder.php">Order History</a></li>
            </ul>
        </div>
</footer>
</div>

Indenting properly helps others to read lines much better. Notice how I indented compared to how you indented. I even indented the lists to help make sure that they are closed off when needed. You should go through all your html, indent it properly, and then assess where other div containers or whatever haven't been properly closed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.