2016-10-03 47 views
-2
Description i am calling images from database , i want to click on particular image to get detailed of that image which i had stored in table . 

在一个表格行中,我打印所有图像,并给出onclick“alert(”)这里我得到了我单击的图像的id。所以如何通过变量,我正在图像点击到其他页面从数据库(这样我可以调用从ID的所有细节)。如何获取从数据库调用的可点击图片的变量?

<html><body> 
echo"<table>"; 
echo "<tr>"; 



echo "<th>"; echo "<h1>";echo"Id";echo "</h1>";echo "</th>"; 



echo "<th>"; echo "<h1>";echo"Logo of Websites";echo "</h1>";echo "</th>"; 

echo "<th>"; echo "<h1>";echo"WebSite Name";echo "</h1>";echo "</th>"; 

echo "<th>"; echo "<h1>";echo"WebSite Link";echo "</h1>";echo "</th>"; 

echo "<th>"; echo "<h1>";echo"WebSite Rating";echo "</h1>";echo "</th>"; 



echo "<th>"; echo "<h1>";echo"Rate Here";echo "</h1>";echo "</th>"; 



echo"</tr>"; 

while($row = mysqli_fetch_assoc($find_data)){ 

echo"<tr>"; 

echo"<td>"; echo $row["id"]; echo"</td>"; 
?><div name = "ashish"><?php 
$idd=$row["id"];?></div><?php 
$showLink=$row["game"]; 


echo"<td>";?> <img src="images\logo\<?php echo $row["votted"];?>"  height="100px" weidth="60px" data-toggle="modal" data-target="#myModal" onClick="alert(<?php echo $row['id']; ?>)"> <?php echo"</td>"; 

echo"<td>"; echo $row["picture"]; echo"</td>"; 

echo"<td>";?><a href="https://<?php echo $row["game"]?>"> <?php echo  $row["game"]; ?></a><?php echo"</td>"; 

echo"<td>"; echo "Total Rating -> ";echo $row["rating"]; echo "</br>";echo  "Total number of People Voted -> ";echo$row["hits"]; 
echo"</td>"; 
echo"<td>"; ?><form action='index.php?option=com_content&view=article&id=47' method ='POST' enctype='multipart/form-data' ><input type='submit' value='Rate Here !' name='rateus'/></form><?php echo"</td>"; 

echo "</tr>"; 

} 
echo"</table>"; 
</body> 

</html> 
    Description i am calling 

图像, 我想点击 特定图像来获得其 我已经存储在表中的图像的详细 。

回答

0

用简单的方法试试楚先生行动,改变

echo"<td>"; echo $row["picture"]; echo"</td>"; 

TO

echo "<td><a href='viewpage.php?id=".$row['id']."'</a>", $row["picture"], "</td>"; 

viewpage.php

$imageId = $_GET['id']; 
// Here select the details of image using $imageId and display it here. 
+0

做相同的,但能够检索ID? –

+0

您可以检索id的值,因此在打印$ id = $ row ['id']时使用 – Sarath

+0

进行选择查询,它将打印1,并且如果我将该id放在拍摄图像比打印id我点击的图像,那么如何检索该ID? –

相关问题