Print Random Record in PHP
<?php $sql = "select * from category order by RAND() limit 20"; $q1 = mysql_query($sql) or die(mysql_error() . $sql); while($r=mysql_fetch_assoc($q1)) { ?> <div class="col-md-3 col-sm-4 col-xs-6"> <div class="category-item"> <a href="search-result.php"><?php echo $r['name']; ?></a> </div> </div> <?php } ?>