taneya Posted May 16, 2008 Share Posted May 16, 2008 Hi all, an inexperienced user here but I hope this is a simple question. I have a page on my site that shows results from a search. Each row of results contains an ID number. How do I turn that ID number into a link? I plan to use this link to show more details. I would prefer not to have to hard code a URL into the database table (a workaround I have used before). I am interested in very basic explanations and possibly some sample code I could study? Or, perhaps be pointed to a book/website I can read to help me understand how to do it? thank you in advance. Quote Link to comment Share on other sites More sharing options...
naveenbj Posted May 16, 2008 Share Posted May 16, 2008 show the code here Quote Link to comment Share on other sites More sharing options...
priti Posted May 16, 2008 Share Posted May 16, 2008 hi taneya, well creating a url is not a tuff job once you are ready with your id from the database but it depends how you are expecting them to create. suppose you are turn with id 1,2,3,4,7,10 If they all belong to same page them its simple $i=0; foreach($id_arr as $id) { $url_arr[$i]='path/to/page/category/product/id='.$id; $i++; } so $url_arr is a url array which you can use. but if these id belongs to different pages then the static part for the url has to be defined based on some criteria like categories etc.... so kindly share how you are thinking about it. Regards Quote Link to comment Share on other sites More sharing options...
peranha Posted May 16, 2008 Share Posted May 16, 2008 you would just put <a href="page.php?id=<?php echo $row[0];?>"></a> the row is the database row, and then on the next page, use $id = $_GET['id']; with some checks to make sure it is what you are expecting. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.