Advertisement
Guest User

Untitled

a guest
Jun 13th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.21 KB | None | 0 0
  1. <div class="container">
  2.  
  3. <h1 style="text-align: center;">For Sale</h1>
  4. <h5 style="text-align: center; margin-bottom: 35px">If you have any question please get intouch via the contact us form <a href="contactus.php">here</a> referencing the stock number.</h5>
  5.  
  6. <!--PHP Loop to show all cars for sale with modal pop up window-->
  7. <?php
  8.  
  9. include 'Login-System/db.php';
  10.  
  11. $query = 'SELECT * FROM forsale ORDER by StockID ASC';
  12. $result = mysqli_query($conn, $query);
  13. $x = 1;
  14. if($result):
  15. if(mysqli_num_rows($result)>0):
  16. while($forsale = mysqli_fetch_assoc($result)):
  17.  
  18. ?>
  19.  
  20. <div class="col-md-6" >
  21. <div class="forsale">
  22. <?php
  23. $match = $forsale['StockID'];
  24.  
  25. $queryimg = "SELECT * FROM forsaleimg WHERE StockID = ".$match." ORDER BY 'Order' ASC ";
  26. $resultimg = mysqli_query($conn, $queryimg);
  27. $y = mysqli_num_rows($resultimg);
  28.  
  29. ?>
  30.  
  31. <!--Image Carousel-->
  32. <div id="myCarousel<?php echo $x;?>" class="carousel slide">
  33. <!-- Indicators -->
  34. <ol class="carousel-indicators">
  35. <?php
  36. for($i=0; $i <$y; $i++){
  37. ?>
  38. <li data-target="#myCarousel" data-slide-to="<?php echo $i;?>" <?php if ($i == 0) {
  39. echo 'class="active"';
  40. } ?>></li>
  41. <?php
  42.  
  43. }
  44. ?>
  45. </ol>
  46.  
  47. <!-- Wrapper for slides -->
  48. <div class="carousel-inner" role="listbox" style="width:auto; height:auto;" >
  49. <?php
  50. $active = 0;
  51. if($resultimg):
  52. if(mysqli_num_rows($resultimg)>0):
  53. while($forsaleimg = mysqli_fetch_assoc($resultimg)):
  54.  
  55. ?>
  56.  
  57. <div class="carosuel-item item <?php if ($active == 0){echo 'active';}?>" id="carouselimg">
  58. <img class="d-block w-100 img-responsive" id="caraimg" src="<?php echo $forsaleimg['FileDestination']; ?>">
  59. </div>
  60.  
  61. <?php
  62. $active= $active + 1;
  63. endwhile;
  64. endif;
  65. endif;
  66. ?>
  67.  
  68. </div>
  69.  
  70. <!-- Left and right controls -->
  71. <a class="left carousel-control" href="#myCarousel<?php echo $x;?>" role="button" data-slide="prev">
  72. <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
  73. <span class="sr-only">Previous</span>
  74. </a>
  75.  
  76. <a class="right carousel-control" href="#myCarousel<?php echo $x;?>" role="button" data-slide="next">
  77. <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
  78. <span class="sr-only">Next</span>
  79. </a>
  80. </div>
  81.  
  82. <!--Quick Details-->
  83. <h4 class="text-info"><?php echo $forsale['make'];?> <?php echo $forsale['model'];?> <?php echo $forsale['variant'];?></h4>
  84. <h4>Price: £<?php echo $forsale['price'];?></h4>
  85. <!--<input type="hidden" id="stockbox" value="<?php echo $forsale['StockID'];?>">-->
  86. <p id="stockref" class="form-control">Stock Ref: <?php echo $forsale['StockID'] ?></p>
  87. <button type="button" class="btn btn-md form-control" id="descbtn" onclick="MainDescription()">View More</button>
  88.  
  89. <div class="maindescription" style="display:block">
  90. <p id="descYear" class="form-control">Year: <?php echo $forsale['year'] ?></p>
  91. <p id="descMileage" class="form-control">Mileage: <?php echo $forsale['mileage'] ?></p>
  92. <p id="descFuel" class="form-control">Fuel: <?php echo $forsale['fuel'] ?></p>
  93. <p id="descDoors" class="form-control">No. Doors: <?php echo $forsale['doors'] ?></p>
  94. <p id="descTrans" class="form-control">Transmission: <?php echo $forsale['trans'] ?></p>
  95. <p id="descEnginesize" class="form-control">Engine Size: <?php echo $forsale['enginesize'] ?></p>
  96. <p id="description" class="form-control">Description: <?php echo $forsale['description'] ?></p>
  97. </div>
  98. </div>
  99. </div>
  100.  
  101. <?php
  102. $x++;
  103. endwhile;
  104. endif;
  105. endif;
  106. ?>
  107. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement