nickelaj xxx nickelaj xxx - 1 year ago 108
SQL Question

Using fancybox with php database

I am trying to list products images , and show their own gallery with popup fancybox. A can list all the images from database products but cant filter when clicking the image. It shows all photos.

Can you help me please.

<?php $query_product = mysql_query("SELECT * FROM products WHERE status = '1' AND language_parent_id = '0' AND id = '".$row_product_id['product_id']."' ORDER BY sort_order");
$row_product = mysql_fetch_array($query_product);
$imageFile = HTTP_RESIM.'products/'.$row_product['image'];

<section class="flexslider">
<ul class="slides">
<?php $imageFile = HTTP_RESIM.'products/'.$row_product['image'];
$query_resim = mysql_query("SELECT * FROM product_image WHERE product_id = '".$row_product['id']."' AND status = '1' ORDER BY sort_order");

while($row_product_resim = mysql_fetch_array($query_resim)){ ?>
<?php $imageFile2 = HTTP_RESIM.'product_image/'.$row_product_resim['image']; ?>
<li><?php echo "<a href=\"$imageFile2\" rel=\"fancybox-gallery\" ><img src=\"$imageFile\" /></a>"; ?> </li>
<?php } ?>

Answer Source

Their docs say you should use it like this.

<a class="fancybox" rel="group" href="big_image_1.jpg"><img src="small_image_1.jpg" alt="" /></a>

So you will need to add the class "fancybox" to the anchor tag.

Edit: You should not use the mysql functions, they are outdated and very unsafe. Look into PDO ( or mysqli (

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download