Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

73
Vistas
How to retrieve images after clicking thumbnail from a repeat region using Mysql and PHP

I need some help, I have a repeat region which displays pics from a database, when I click on the image I would like to go to another page where there is a photo gallery to display my pictures bigger.

My problem, no matter which thumb I click I get the same set of pictures from the database, which is usually the last thumb listed.

I am new to php, so i am wondering if anyone can help me, thank you.

Code for thumb page `

<?php do { ?>
 <div class="display-property-pic">

<input type="image" id="imageIn1" src="upload/images/<?php echo $row_repeatRegion['thumb']; ?>" alt="Submit" width="100" height="100" ><input name="picHid" type="hidden" value="<?php echo $row_repeatRegion['property_pic1']; ?>"> 
            </div>
<?php } while ($row_repeatRegion = mysqli_fetch_assoc($repeatRegion)); ?>

`

Code for Gallery page

if(isset($_POST['picHid'])){
    $pic = $_POST['picHid'];
}

mysqli_select_db($wiplisttest, $database_wiplisttest);
$query_getPics = "SELECT photos.photo_id, photos.pic1, photos.pic2, photos.pic3 FROM photos WHERE photos.property_pic1 LIKE '%$pic%'";
$getPics = mysqli_query($wiplisttest, $query_getPics) or die(mysql_error($wiplisttest));
$row_getPics = mysqli_fetch_assoc($getPics);
$totalRows_getPics = mysqli_num_rows($getPics);

    <div class="album">
       <div class="description">fixed images</div>
        <ol>
        <?php do { ?>
        <li>
            <h4><?php echo "Pic"." ".$row_getPics['pic3']; ?></h4>
            <div class="description">Salzburg, Austria</div>
            <a href="upload/images/<?php echo $row_getPics['pic3']; ?>">
            <img src="upload/images/<?php echo $row_getPics['pic2']; ?>" />
            </a>
        </li>
           <?php } while ($row_getPics = mysqli_fetch_assoc($getPics)); ?>
        </ol>
    </div>
9 months ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

As you have stored images info in database, there should be id assigned to each image, so when you click on any specific image, get id of that image and retrieve that image on another page using the id.

9 months ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos