JakeMogul Posted November 29, 2012 Share Posted November 29, 2012 I'm very new to MySQL and trying to learn the basics. My question is this: I've created a simple database containing details of items owed to various patients by the pharmacy. I have made a search feature so that the staff can search quickly. In the search results, each patient's name is hyperlinked. When the hyperlink is clicked, I want it to go to a page where it displays all data from that row in the database table related to that patient. I have done this with an OwingID auto-incrementing variable in the table. I have the page set up where the data will display and can make it display any record I choose with this command: $displayowing = mysql_query("SELECT Date, FirstName, LastName, Item, Quantity FROM tOwings WHERE OwingID=1"); but I have to change the OwingID in the code myself from the server side. How do I make the links from the search results do this for me? Thanks... Link to comment https://forums.phpfreaks.com/topic/271339-very-simple-question-about-displaying-mysql-database-data/ Share on other sites More sharing options...
Barand Posted November 29, 2012 Share Posted November 29, 2012 Add the id to the link with a querystring <a href='mypage.php?id=42'>name</a> in the php script: $id = intval($_GET['id']); $displayowing = mysql_query("SELECT Date, FirstName, LastName, Item, Quantity FROM tOwings WHERE OwingID=$id "); Link to comment https://forums.phpfreaks.com/topic/271339-very-simple-question-about-displaying-mysql-database-data/#findComment-1396139 Share on other sites More sharing options...
JakeMogul Posted November 29, 2012 Author Share Posted November 29, 2012 Thanks! It works! Very grateful! Link to comment https://forums.phpfreaks.com/topic/271339-very-simple-question-about-displaying-mysql-database-data/#findComment-1396148 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.