I have a page that displays some information from the database. I want to add a link to each row (say the name as a link) that I can click to jump to a page that displays the rest of the information for that row (say a profile page). I thought about creating a link that passes the id to the profile page so the profile page can get the information.
I'm sure this is simple, but I just don't get it. How can I display a link in each row that only sends the id number of that row? Because I don't want to go to each row and create a special link.
Here is the code I have:
connect_error) { die("连接失败: " . $conn->connect_error); } $sql = "SELECT id, FirstName, LastName, Phone, Email FROM Contacts"; $result = $conn->query($sql); if ($result->num_rows > 0) { // 输出每一行的数据 while($row = $result->fetch_assoc()) { echo "id: " . $row["id"]. " - Name: " . $row["FirstName"]. " " . $row["LastName"]. " " . $row["Phone"]. " " . $row["Email"]. "
"; } } else { echo "0 结果"; } $conn->close(); ?>```
Based on your example, you can do this: