Get url from function and put content into template

Hi,

I have been searching all over the web and every thread in these forums for the issue I am having but I can’t find anything (I’ve done about a billion different google searches).

Here is my issue:

I am creating a pagination type setup with PHP and MySQL through a template. The template loads different content based on what is in the url box in your browser. So if:

http://www.mysite.com/template.php?=page1

…you should get row 1 of table ‘example’ from the database “_test”. What should happen is column “content” should go into the place where my function:

<?php get_content(); ?>

…is.

My current trial to get the function to work is here:

function put_header() {
		$p = mysql_query("SELECT $i FROM articles");
		while ($result = mysql_fetch_array($p)) {
		$i = $result['id'];
		}
		
		for($i=0; $i<=0; $i++) {
			if($title .= $i) {
				$url .= "?page=$i";
			} else {
				return 'No content to show';
			}
		}
	}
$title

…is actually a short variable of…

$row['headline']

… which basically makes it easier to get the column ‘headline’ from each row in the database table.

So basically I want a navigation on the left of the content that makes the url show up as ?page=$i. $i is row[‘id’] in the same column as ‘headline’ and is an auto_increment in the table.

Each navigation item will be a link to each ‘id’ and put the ‘headline’ into the template based on the ‘id’ number.

Any help is appreciated as I’ve searched everything for help. If I didn’t explain good enough I will be back online tomorrow to explain more if needed.

THANKS!