Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="container">
- <h1 style="text-align: center;">For Sale</h1>
- <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>
- <!--PHP Loop to show all cars for sale with modal pop up window-->
- <?php
- include 'Login-System/db.php';
- $query = 'SELECT * FROM forsale ORDER by StockID ASC';
- $result = mysqli_query($conn, $query);
- $x = 1;
- if($result):
- if(mysqli_num_rows($result)>0):
- while($forsale = mysqli_fetch_assoc($result)):
- ?>
- <div class="col-md-6" >
- <div class="forsale">
- <?php
- $match = $forsale['StockID'];
- $queryimg = "SELECT * FROM forsaleimg WHERE StockID = ".$match." ORDER BY 'Order' ASC ";
- $resultimg = mysqli_query($conn, $queryimg);
- $y = mysqli_num_rows($resultimg);
- ?>
- <!--Image Carousel-->
- <div id="myCarousel<?php echo $x;?>" class="carousel slide">
- <!-- Indicators -->
- <ol class="carousel-indicators">
- <?php
- for($i=0; $i <$y; $i++){
- ?>
- <li data-target="#myCarousel" data-slide-to="<?php echo $i;?>" <?php if ($i == 0) {
- echo 'class="active"';
- } ?>></li>
- <?php
- }
- ?>
- </ol>
- <!-- Wrapper for slides -->
- <div class="carousel-inner" role="listbox" style="width:auto; height:auto;" >
- <?php
- $active = 0;
- if($resultimg):
- if(mysqli_num_rows($resultimg)>0):
- while($forsaleimg = mysqli_fetch_assoc($resultimg)):
- ?>
- <div class="carosuel-item item <?php if ($active == 0){echo 'active';}?>" id="carouselimg">
- <img class="d-block w-100 img-responsive" id="caraimg" src="<?php echo $forsaleimg['FileDestination']; ?>">
- </div>
- <?php
- $active= $active + 1;
- endwhile;
- endif;
- endif;
- ?>
- </div>
- <!-- Left and right controls -->
- <a class="left carousel-control" href="#myCarousel<?php echo $x;?>" role="button" data-slide="prev">
- <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
- <span class="sr-only">Previous</span>
- </a>
- <a class="right carousel-control" href="#myCarousel<?php echo $x;?>" role="button" data-slide="next">
- <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
- <span class="sr-only">Next</span>
- </a>
- </div>
- <!--Quick Details-->
- <h4 class="text-info"><?php echo $forsale['make'];?> <?php echo $forsale['model'];?> <?php echo $forsale['variant'];?></h4>
- <h4>Price: £<?php echo $forsale['price'];?></h4>
- <!--<input type="hidden" id="stockbox" value="<?php echo $forsale['StockID'];?>">-->
- <p id="stockref" class="form-control">Stock Ref: <?php echo $forsale['StockID'] ?></p>
- <button type="button" class="btn btn-md form-control" id="descbtn" onclick="MainDescription()">View More</button>
- <div class="maindescription" style="display:block">
- <p id="descYear" class="form-control">Year: <?php echo $forsale['year'] ?></p>
- <p id="descMileage" class="form-control">Mileage: <?php echo $forsale['mileage'] ?></p>
- <p id="descFuel" class="form-control">Fuel: <?php echo $forsale['fuel'] ?></p>
- <p id="descDoors" class="form-control">No. Doors: <?php echo $forsale['doors'] ?></p>
- <p id="descTrans" class="form-control">Transmission: <?php echo $forsale['trans'] ?></p>
- <p id="descEnginesize" class="form-control">Engine Size: <?php echo $forsale['enginesize'] ?></p>
- <p id="description" class="form-control">Description: <?php echo $forsale['description'] ?></p>
- </div>
- </div>
- </div>
- <?php
- $x++;
- endwhile;
- endif;
- endif;
- ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement