title: Display products from database in php
body: <p>I want to display product details in php page that is stored in mysql database.
  my php page is as follows:</p>
  
  <pre><code> &lt;?phpinclude 'databaseconfile.php';
      $sql = "select * from book";
      $result = mysql_query($sql);
      ?&gt;
      &lt;html&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
          &lt;meta name="description" content=""&gt;
          &lt;meta name="author" content=""&gt;
          &lt;title&gt;Shop | ShareMyBook&lt;/title&gt;
          &lt;link href="css/bootstrap.min.css" rel="stylesheet"&gt;
          &lt;link href="css/font-awesome.min.css" rel="stylesheet"&gt;
          &lt;link href="css/prettyPhoto.css" rel="stylesheet"&gt;
          &lt;link href="css/animate.css" rel="stylesheet"&gt;
          &lt;link href="css/main.css" rel="stylesheet"&gt;
          &lt;link href="css/responsive.css" rel="stylesheet"&gt;     
          &lt;link rel="shortcut icon" href="images/ico/favicon.ico"&gt;
          &lt;link rel="apple-touch-icon-precomposed" sizes="144x144" href="images/ico/apple-touch-icon-144-precomposed.png"&gt;
          &lt;link rel="apple-touch-icon-precomposed" sizes="114x114" href="images/ico/apple-touch-icon-114-precomposed.png"&gt;
          &lt;link rel="apple-touch-icon-precomposed" sizes="72x72" href="images/ico/apple-touch-icon-72-precomposed.png"&gt;
          &lt;link rel="apple-touch-icon-precomposed" href="images/ico/apple-touch- icon-57-precomposed.png"&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;div class="col-sm-4"&gt;
          &lt;div class="product-image-wrapper"&gt;
              &lt;div class="single-products"&gt;
                  &lt;div class="productinfo text-center"&gt;
                      &lt;?phpwhile ($row = mysql_fetch_array($result))
                      {?&gt;
                      &lt;img src="images/home/" alt="" /&gt;
                      &lt;h2&gt;&lt;?php echo $row['Book_Name']; ?&gt;&lt;/h2&gt;
                      &lt;p&gt;Book 10&lt;/p&gt;
                      &lt;?php}?&gt;
                  &lt;/div&gt;
                  &lt;div class="product-overlay"&gt;
                      &lt;div class="overlay-content"&gt;
                          &lt;h2&gt;Price&lt;/h2&gt;
                          &lt;p&gt;Book 10&lt;/p&gt;
                          &lt;a href="#" class="btn btn-default view-item"&gt;&lt;i class="glyphicon glyphicon-eye-open"&gt;&lt;/i&gt;view Book&lt;/a&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
              &lt;/div&gt;
              &lt;div class="choose"&gt;
                  &lt;ul class="nav nav-pills nav-justified"&gt;
                      &lt;li&gt;&lt;a href="#"&gt;&lt;i class="fa fa-plus-square"&gt;&lt;/i&gt;Add to  wishlist&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="#"&gt;&lt;i class="fa fa-shopping-cart"&gt;&lt;/i&gt;Add to  cart&lt;/a&gt;&lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>when I try to run this page it says-Notice:Undefined variable:row on line 32, when it is already defined.</p>