How do you create a dynamic link to table data?

A

Anonymous

Guest
I'm new to this and don't even know how search for the answer!

I created a script that displays data from a mysql table. The script shows each row in the table over multiple pages (paging). I want to add a link to each row that uses the primary id field to link to a common .php page that will display the data associated with the each id.

Basically, I'm trying to create one php page that will display data from a specific row. I want the page to pull the table row from the link.

My problem is I don't know enough to even do a search for a tutorial. I'm not looking for someone to fix my code, just point me in the right direction.

Thanks!
 
Hi,

this is very simple

do just below thing if I am right...

Code:
<a href="common_page_name.php?primary_key=<?=$pk?>">Link Display Name</a>

e.g.

Code:
<a href="edit_page.php?product_id=<?=$array_product[$i]['product_id']?>&action=edit"><?=$array_product[$i]['product_name']?></a>
if you see the view source there should be output like this:

<a href="edit_page.php?product_id=1&action=edit">Computer</a>
<a href="edit_page.php?product_id=2&action=edit">Web Came</a>
<a href="edit_page.php?product_id=3&action=edit">Monitor</a>

for edit_page.php

you should write condition like this:

Code:
if($_REQUEST['action'] == "edit" && $_REQUEST['product_id''] != "")
{
       $query = "select * from table_name where product_id = '".$_REQUEST['product_id'']."'";
}


http://www.thevariyasoft.com
 
Thanks for the reply!

I actualy figured this out already. I was missing some single qoutes from my code that was causing the GET function to not return the results.
 
Back
Top