gpt4 book ai didi

php - 单行的详细信息按钮 [PHP,MYSQL]

转载 作者:行者123 更新时间:2023-11-30 22:02:17 25 4
gpt4 key购买 nike

目前我有一些 php 代码可以为每一行返回一个 div View ,里面有一个图像和一些文本,但现在我希望我可以通过单击一个按钮从该行转到详细信息页面,但我没有'知道如何在 php 中做到这一点,有人可以帮助我吗?

下面的代码是查看所有行

$servername = "localhost";
$username = "root";
$password = "1234";
$dbname = "Motion";
$Teller = 0;
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT id, camera, filename, frame, file_type, time_stamp, event_time_stamp FROM security ".$WhereBetween."group by time_stamp";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
//echo "<table><tr><th>camera</th><th>filename</th><th>frame</th><th>file_type</th><th>time_stamp</th><th>event_time_stamp</th></tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<!-- thumbnail image wrapped in a link -->
<div class='Blok'>
<a href='#img".$teller."' class='Afbeelding'>
<img src='".str_replace("/var/www/html","",$row["filename"])."' class='thumbnail'>
</a>
<div class='Tekst'>
<h3>Motion Detection</h3>
<p>
Camera ID: ".$row["camera"]."<br>
Timestamp: ".$row["time_stamp"]."<br>
Filename:".str_replace("/var/www/html/img/","",$row["filename"])."
</p>
//Here i want the button to go to detail page
</div>
</div>";

最佳答案

我会写这个答案,但我很忙。我回答了一个类似的问题。检查这个How to get same row data when click on button using PHP

所以你做的很简单。在您的 while 循环中,将主键的值放在模态 onclick 上。这将链接到您的引导 View 模式

如果没有帮助,请评论

关于php - 单行的详细信息按钮 [PHP,MYSQL],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43013809/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com