Jump to content

linking to profile data


stuart7398

Recommended Posts

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

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());

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.