stuart7398 Posted March 25, 2008 Share Posted March 25, 2008 Hi. I have a page with products which I want to link to their profile page to show the full description. My problem is that when I click each product link I get the same data show up in the profile page <code> ProfilePage.php <?php require '../conn.php'; require '../conndb.php'; $data = mysql_query("SELECT * FROM products") or die(mysql_error()); $info = mysql_fetch_array( $data ); { Print "<table style='table-layout:fixed; width:100%'>"; </code> <code> Linkspage.php <?php require '../conn.php'; require '../conndb.php'; $data = mysql_query("SELECT * FROM `products` ORDER BY `purchase_date` DESC LIMIT 10") OR DIE (mysql_error()); if (mysql_num_rows($data) > 0 ) { while($info = mysql_fetch_array($data)) { Print "<p><a href='../pages/products.php?id=".$info['p_id']."'>".$info['name'] . " {$info['col_2']}<img src=/pages/images/".$info['photo'] ." align='middle' width='80px' alt='Escort: Ambers Escorts' border='0'/><i>{$info['location']}</i></a></p>"; </code> Any help appreciated, Thanks. Link to comment https://forums.phpfreaks.com/topic/97812-linking-to-profile-data/ Share on other sites More sharing options...
BlueSkyIS Posted March 25, 2008 Share Posted March 25, 2008 your query has no WHERE clause, so you get ALL records. you may want to limit the records returned using the product id something like this: $id = mysql_real_escape_string(trim($_GET['id'])); $data = mysql_query("SELECT * FROM products WHERE id = '$id'") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/97812-linking-to-profile-data/#findComment-500439 Share on other sites More sharing options...
stuart7398 Posted March 25, 2008 Author Share Posted March 25, 2008 i love you Link to comment https://forums.phpfreaks.com/topic/97812-linking-to-profile-data/#findComment-500453 Share on other sites More sharing options...
BlueSkyIS Posted March 25, 2008 Share Posted March 25, 2008 sorry, i'm married. Link to comment https://forums.phpfreaks.com/topic/97812-linking-to-profile-data/#findComment-500454 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.