Page 1 of 1

Using Mysql data that was used on one page to link 2 content

Posted: Thu Mar 25, 2010 3:02 am
by fernandizo
Im new to PHP

Here is my problem

I have links that are created by querying a Mysql DB. Thes links are the titles of articles. The articles title links to a page that conatins div tags with id's associated with them. Everything workd great. Now my boss wants the articles to display in its own page, I am using an index page with php pages embedded into them like this.

http://www.somesite.org/index.php?page=about

How do I send the variable "article ID" from the links(queried from the database) to another page that queries using " article ID" and then display the title and content in it own page? Basically how do I send the variable of "article ID" through a link and use that variable in a query to extract data from a database?

Would I have to use a form or can I use a link? never seen this before, that's why I am asking. thanks

Re: Using Mysql data that was used on one page to link 2 content

Posted: Thu Mar 25, 2010 9:31 am
by daebat

Code: Select all

<a href='testedit.php?id=".$info['id'] ."'> ".$info['title'] ."</a>
then on the next page:

Code: Select all

$id=$_GET['id'];
 
$data = mysql_query("SELECT * FROM test WHERE id = '$id'") or die(mysql_error());