Can someone point me in the right direction, what I am trying to do is use the result set that I have from a php query to a mysql table. I would like to be able to individually select a record from a query result that returns multiple records. I have the code and queries done already, I just don't know how to select a record using a unique id from the listed results. Is there a way to make each row that is returned linkable, so that if it is clicked it can return the individual record? I am new at php, so please be easy on me... Thanks in advance.
mrpeterc
0
Newbie Poster
Recommended Answers
Jump to PostThis may not be the right answer, but I would think that you could make form in a for each statement and have the button text populated by the unique id also create the query . I'm thinking like
$link=mysql_connect(host, username, pass); mysql_select_db('my_database'); $query='SELECT `uniqueid` FROM `table`'; …
Jump to PostThis is the absolute simplest way to do it. You'll have to take measures to prevent sql injection and implement other security features.
Place a link on the returned result like this:echo" <a href='whatever.php?name=$name'>$name</a>";
Jump to PostWhatever you do, be sure you escape the result if you use it directly in a MySQL query. You don't want to be the victim of SQL injection.
All 9 Replies
Dsiembab
5
Junior Poster
buddylee17
216
Practically a Master Poster
mrpeterc
0
Newbie Poster
Fest3er
39
Posting Whiz in Training
Dsiembab
5
Junior Poster
Fest3er
39
Posting Whiz in Training
buddylee17
216
Practically a Master Poster
Dsiembab
5
Junior Poster
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.