Ok so I have my database that has multiple ads...BUT I have multiple ads from the same site that have been added....here is an example.
As you can see...the database has two links that are different...but they lead to the same site. My goal is to have it RANDOMLY select one of them and display it but not the other WHILE ALSO selecting all of the others and displaying those as well. Here is the coding I have at the moment for it:
<?php
$query = 'SELECT * FROM `ads`';
$results = mysqli_query($connect, $query) or die(mysql_error());
while ($row = mysqli_fetch_array($results, MYSQLI_ASSOC)) {
extract($row);
echo '
<div class="col-sm-6">
<div class="card mb-30"><a class="card-img-tiles" href="'.$link.'">
<div class="inner">
<div class="main-img"><img src="'.$image.'" alt="'.$alt_title.'"></div>
</div></a>
<div class="card-body text-center">
<h4 class="card-title">'.$name.'</h4>
'.$about.'
<a class="btn btn-outline-primary btn-sm" href="'.$link.'">Check It Out</a>
</div>
</div>
</div>
';
}
?>
I want it to display the circled ones randomly selected but not both for each set.
Aucun commentaire:
Enregistrer un commentaire