1

I am trying to display my images from database. I have a variable named as $image. This variable contains jpeg names and I have a folder named as uploads which stores the images. I am looking to display my images in large size when clicking the thumbnail image Please Help me Anyone............

this is my code

     <?php
     include("connection.php");
     $target="uploads/thumbnails/";
     $email=$_SESSION['email'];
     if($email==NULL)
     {
          header("location:register.php");
     }
     else
     {
         $start=0;
         $limit=2;
         $page=1;
         if(isset($_GET['page']))
         {
             $page=$_GET['page'];
             $start=($page-1)*$limit;
         }
         $sql=mysql_query("select * from photos where email='$email' LIMIT  $start,$limit");
         while($row=mysql_fetch_array($sql))
         {
             $image=$row['image_name'];
             echo $image;
         ?>
    <form action="" method="POST">
    <div class="img">
    <a target="_blank" href="uploads/".$image>//Error in this line
    <img src="<?php echo $target.$row['thumb']; ?>" /></a>
    </form>
    </div>
    <?php
}
        $query=mysql_num_rows(mysql_query("select * from photos where '$email'=email"));
        $total=ceil($query/$limit);
        for($i=1;$i<=$total;$i++)
        {
            if($i==$page)
            {
                echo  $i;
            }
            else
            {   
                echo "<a href='?page=".$i."'>"."     ".$i."</a>";

            }
        }

  }

        ?>
1
  • check this part of code where '$email'=email" Commented May 19, 2016 at 6:05

1 Answer 1

1

You need write that error line like this

 <a target="_blank" href="uploads/<?php echo $image ?>">//Error in this line
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.