Php 如何将数据库数据显示到另一个页面?
这是我的房间表代码Php 如何将数据库数据显示到另一个页面?,php,database,html-table,Php,Database,Html Table,这是我的房间表代码 <?php include'db.php'; $sql=mysql_query("Select*from tb_rooms1"); echo "<div class='container'>"; echo "<div class='scrolltable'>"; echo "<table class= 'table table-striped table-bordered'>"; ech
<?php
include'db.php';
$sql=mysql_query("Select*from tb_rooms1");
echo "<div class='container'>";
echo "<div class='scrolltable'>";
echo "<table class= 'table table-striped table-bordered'>";
echo"<th><div align='center'>ID</div></th>";
echo"<th><div align='center'>Image</div></th>";
echo"<th><div align='center'>Room Name</div></th>";
echo"<th><div align='center'>Description</div></th>";
echo"<th><div align='center'>Price Per Night</div></th>";
echo"<th><div align='center'>Status</div></th>";
echo"<th><div align='center'>Reserve</div></th>";
while($row=mysql_fetch_array($sql))
{
@$id=$row['eid'];
echo"<tr align='center'>";
echo"<td><div style='font-size:11px;' align='center'>".$row['roomID']</div></td>";
echo"<td><div style='font-size:11px;' align='center'><img width=72 height=52 alt='Unable to View' src=".$row['image']."></div></td>";
echo"<td><div style='font-size:11px;' align='center'>".$row['name']."</div></td>";
echo"<td><div style='font-size:11px;' align='center'>".$row['description']."</div></td>";
echo"<td><div style='font-size:11px;' align='center'>".$row['price']."</div></td>";
echo"<td><div style='font-size:11px;' align='center'>".$row['status']."</div></td>";
echo"<td><div align='center' style='margin-top:30px'><input style='margin-top:-2px;' type='checkbox'></div></td>";
}
echo"</table>";
echo"</div>";
echo"</div>";
?>
使您的房间可单击,并将房间id作为参数传递
echo"<td><div style='font-size:11px;' align='center'><a href='otherpage.php?roomid={$row['roomID']}'> Room {$row['roomID']}</a></div></td>";
echo”“;
在您的另一个php文档中,您会看到如下内容:
otherpage.php
<?php
include'db.php';
$roomid = $_GET['roomid'];
$lookupQuery = mysqli_query("SELECT * FROM tb_rooms1 WHERE roomID = [$roomid]");
otherpage.php
您需要更具体一点,您是否试图使每个房间都可以点击?我想使用复选框。所以当我点击它并保留。它将显示我选择的房间的详细信息。你能帮帮我吗?