I am using the RoyalSlider plugin (dimsemenov.com/plugins/royal-slider) to display the first 6 items from a MySQL database in the slider using PHP. I am using the LIMIT function to restrict each slide to 3 items so that the first slide displays items 1-3 from the DB and the second slide shows items 4-6. This works but it uses two separate SELECT / LIMIT queries which adds to page load time. Is it possible to merge the two separate LIMIT queries into one query?
The code I have so far is:
HTML / PHP
<div class="royalSlider rsDefault">
<div class="rsContent">
<ul>
<?php
$qry = mysql_query("SELECT * FROM properties LIMIT 0,3");
while($property = mysql_fetch_array($qry)) {
echo '<li><a href="/property.php?id='.$property['property_id'].'">
<img class="img-main" src="/files/'.$property['property_id'].'-1.jpg" title="" alt=""/>
<h2>'.$property['property_name'].'</h2>
<h3>'.$property['property_location'].'</h3>
</a>
</li>';
}
?>
</ul></div>
<div class="rsContent">
<ul>
<?php
$qry = mysql_query("SELECT * FROM properties LIMIT 3,3");
while($property = mysql_fetch_array($qry)) {
echo '<li><a href="/property.php?id='.$property['property_id'].'">
<img class="img-main" src="/files/'.$property['property_id'].'-1.jpg" title="" alt=""/>
<h2>'.$property['property_name'].'</h2>
<h3>'.$property['property_location'].'</h3>
</a>
</li>';
}
?>
</ul></div></div>