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:
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:
Popular Topics
More>
Laravel Tutorial
PHP Tutorial
Java Tutorial
PHP Tutorial
Popular Articles
-
PEPE Price Prediction: PEPE Struggles to Replicate February-May Rallies, Will It Succumb to Profit-Taking Pressure?
-
How Trump Became Pro-Bitcoin
-
How to turn on edge browser automatic translation tutorial
-
Should you pry or comfort in Star Wars Outlaws?
-
Garmin Enduro 3: \'Ultra-performance GPS smartwatch\' now official with extra-long battery life
Popular Tutorials
More>
Related Tutorials
Popular Recommendations
Latest courses
The latest ThinkPHP 5.1 world premiere video tutorial (60 days to become a PHP expert online training course)
1397477
PHP introductory tutorial one: Learn PHP in one week
4211063
JAVA Beginner's Video Tutorial
2369320
The latest ThinkPHP 5.1 world premiere video tutorial (60 days to become a PHP expert online training course)
1397477
JAVA Beginner's Video Tutorial
2369320
Little Turtle's zero-based introduction to learning Python video tutorial
494696
Quick introduction to web front-end development
213712
Master PS video tutorials from scratch
847376
[Web front-end] Node.js quick start
3639
Complete collection of foreign web development full-stack courses
2783
Go language practical GraphQL
2265
550W fan master learns JavaScript from scratch step by step
490
Python master Mosh, a beginner with zero basic knowledge can get started in 6 hours
12431
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
-
[form button] jQuery enterprise message form contact code
-
[Player special effects] HTML5 MP3 music box playback effects
-
[Menu navigation] HTML5 cool particle animation navigation menu special effects
-
[form button] jQuery visual form drag and drop editing code
-
[Player special effects] VUE.JS imitation Kugou music player code
-
[html5 special effects] Classic html5 pushing box game
-
[Picture special effects] jQuery scrolling to add or reduce image effects
-
[Photo album effects] CSS3 personal album cover hover zoom effect