I have a jQuery slide plugin called swiper slide. I use a slide to display the results from the results of a mysql PHP query at a time.
Currently, my request code and slide code look like this:
PHP QUERY
$query = mysql_query("SELECT * FROM tblClients
WHERE tblclients.package =
'standard' LIMIT 0, 9", $connection);
$query_page_2 = mysql_query("SELECT * FROM tblClients
WHERE tblclients.package =
'standard' LIMIT 9, 9", $connection);
$query_page_3 = mysql_query("SELECT * FROM tblClients
WHERE tblclients.package =
'standard' LIMIT 18, 9", $connection);
SLIDE CODE
<div class="swiper-slide">
<?php while ($rows = mysql_fetch_array($query)) { ?>
<div id="main">
<div id="phone"><?php echo $rows['phone']; ?></div>
<img id="client_img" src="<?php echo $rows['client_img']; ?>">
</div>
<?php } ?>
</div>
<div class="swiper-slide">
<?php while ($rows = mysql_fetch_array($query_page_2)) { ?>
<div id="main">
<div id="phone"><?php echo $rows['phone']; ?></div>
<img id="client_img" src="<?php echo $rows['client_img']; ?>">
</div>
<?php } ?>
</div>
<div class="swiper-slide">
<?php while ($rows = mysql_fetch_array($query_page_3)) { ?>
<div id="main">
<div id="phone"><?php echo $rows['phone']; ?></div>
<img id="client_img" src="<?php echo $rows['client_img']; ?>">
</div>
<?php } ?>
</div>
My question is using jquery or PHP, how can I hide a slide that is empty or has no results inside. Therefore, if I have only 8 results left, the first slide should show only one.
source
share