2016-05-19 22 views
1

我想從數據庫中顯示我的圖像。我有一個名爲$ image的變量。這個變量包含jpeg名稱,我有一個名爲uploads的文件夾來存儲圖像。我期待點擊縮略圖時,在大尺寸顯示我的圖片,請幫助我任何............如何使文件夾和變量的href連接

這是我的代碼

 <?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>"; 

      } 
     } 

    } 

     ?> 
+0

檢查這部分代碼'哪裏'$ email'= email「' – Saty

+0

我明白了 –

回答

1

你需要編寫像這樣的錯誤線

<a target="_blank" href="uploads/<?php echo $image ?>">//Error in this line 
相關問題