我正在使用mysql数据库。我想创建一个链接到php页面的链接。
<?php
$connection = mysql_connect("localhost","root","");
mysql_select_db("scratchdisk",$connection);
$sql = "SELECT * FROM note";
$result = mysql_query($sql);
echo "<table>";
echo "<tr><td>#</td><td>Title</td><td>Action</td></tr>";
while($row=mysql_fetch_assoc($result)){
echo "<tr><td>".$row['#']."</td><td>".$row['Title']."</td><td><a href='view.php' id='view'>View</a></td></tr>"; }
echo "</table>";
?>
我希望在我的$row['#']
上显示下一页,但是相同的view.php文件。
答案 0 :(得分:0)
您可以使用此代码:
<?php
$connection = mysql_connect("localhost","root","");
mysql_select_db("scratchdisk",$connection);
$sql = "SELECT * FROM note";
$result = mysql_query($sql);
echo "<table>";
echo "<tr><td>#</td><td>Title</td><td>Action</td></tr>";
while($row=mysql_fetch_assoc($result)){
echo "<tr><td>".$row['#']."</td><td>".$row['Title']."</td><td><a href='view.php?id=" . $row['#'] . "' id='view'>View</a></td></tr>"; }
echo "</table>";
?>
在 view.php
中if(isset($_GET['id']) && !empty($_GET['id'])){
//Write logic here
$id = $_GET['id'];
}