jbille Posted October 19, 2006 Share Posted October 19, 2006 I have a page that grabs all products matching the selected category from mysql and outputs them on the page. I was wondering how I can set these products up as links where when clicked on it will take you to a whole new page which shows that single product. If anyone could give me an idea on where to start that would be great. It seems to my I would have to create new php files when the link was clicked on. Is this correct. Quote Link to comment Share on other sites More sharing options...
craygo Posted October 19, 2006 Share Posted October 19, 2006 Actually you would be better off making a template. Then when the list of products comes up you set a link to to the template with a parameter to grab the product they want to look at.so your link will go to a page called details.phpyou link will look like this.[code]echo '<a href="details.php?id='.$row['id'].'">';[/code]$row['id'] is the field retrieved from the queryThen on the details page your write a query to retrieve that product[code]<?php$p_id = $_GET['id'];$sql = "SELECT * FROM table WHERE id = '$p_id'";?>[/code]Now you only need one page and the product details are fetched from the query and put in the page.Ray 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.