mercredi 26 octobre 2016

How do I store images from an sql query under different variables if they all have the same id?

My problem is that I'm developing a property website that stores multiple imaages of a property in a different table to the one that stores the information about the table. I use the property_id from the properties table as a foreign key in the images table. However I want to retrieve all these images and store them as different variables for use elsewhere where I display these images in a slider. The code I'm using to retrieve the images is:

$image_result=mysqli_query($con,"SELECT * FROM tbl_images
    WHERE property_id ='$id' ");


while($row_i = mysqli_fetch_array($image_result))
    {   
        $image = $row_i['image'];
        $property_display = cl_image_tag($image, 
                    array( "width" => 800, "height" => 600, "crop" => "fill" ));

    }

I can't think of how to get separate variables for each of the different images, as they each have the same property id. Where I want to use these variables is here:

<img class="mySlides" src="http://ift.tt/2ebQs0B;" style="width:100%">

Any help would be appreciated




Aucun commentaire:

Enregistrer un commentaire