I need 3 rows of data from same table using same query on same page but 3 different places. I use the following query 3 times on a single page to get 3 rows of data and shows it on each place . It makes my page load very slow. Is there any way to get 9 rows of data using single query and use it by splitting 3 rows of data at 3 different places on a same page??
Here is my query:
$result = mysql_query("select * from table order by rand() limit 3 ");
while ($row = mysql_fetch_array($result)){
$a1=$row['a1'];
$a2=$row['a2'];
$a3=$row['a3'];
$a4=$row['a4'];
$a5=$row['a5'];
echo "<div class=\"col-sm-4\"><div class=\"product-image-wrapper\"><div class=\"single-products\"><div class=\"productinfo text-center\"><a3 src=\"$a3\" alt=\"$a1\"><h2>$a4</h2><h5>$a1</h5><a a2=\"$a2\" target=_blank class=\"btn btn-default add-to-cart\"><i class=\"fa fa-shopping-cart\"></i>$a5</a></div></div></div></div>\n";
}