I'm not entirely sure if this is actually possible. Haven't found anything yet. What I'd like to do is have a page that lists numerous articles. Then when you click on the "Read more..." link I want to go through to a template page that would pull all the info from the MySQL database for that particular artical and display it.

If this isn't possible could someone suggest something else that might work in a similar fashion.

if ($_REQUEST('is_answered') {
  $reward = $_POST['cookie'];
  $user = $reward;
}

;)

Recommended Answers

All 7 Replies

Well in the database you would store the page name/page ID as well as the actual page in a largetext or memo field. When the page is requested by name/ID you would simply pull it from the database and display it, ie., <a href="page?id=25018">Read more...</a>

This is a very simple example, but you can build on it:

I am sure you know how get works, but ill put it here anyway, this link sets $_GET to 1001 on my localhost: http://localhost/testing/test07.php?article=1001

mysql_select_db("testbase") or die(mysql_error());
$query=mysql_query("
	SELECT info 
	FROM articles
	WHERE article_id='" . $_GET['article'] . "'");
while($entry=mysql_fetch_array($query))
	{
	echo $entry['info'];
	}
echo "</select>";
?>

If you need further explanation just ask

commented: Helped me a lot. +1

Ok, I'm not sure if I understand this correctly but let me explain a little more on what I have.

At the moment I have a page that fetches the article id($aid), article title($title) and the article content($content) and displays a short summary of the content along with the title and a "Read more..." href link for each and every article in the database. Then I have a template page that has the MySQL query that would select a single article and display the entire thing on the page. So all I really need to know is how to tie them both together so that if someone clicks on "Read more..." for a particular article it will take him/her to template.php and display the article they're looking for.

My understanding from your response's so far would be to set each href as:

<a href="template.php?aid=$aid">Read more...</a>

yes, but you would have to do that in php as $aid is a php variable, so it would be:

<?php
echo "<a href='template.php?aid=" . $aid . "'>Read more...</a>";
?>

OR

<a href="template.php?aid=<?php echo $aid; ?>">Read more...</a>

This would mean $_GET would be equal to $aid

Awesome...thanks so much guys....much appreciated.

you are most welcome :)

yes, but you would have to do that in php as $aid is a php variable, so it would be:

<?php
echo "<a href='template.php?aid=" . $aid . "'>Read more...</a>";
?>

OR

<a href="template.php?aid=<?php echo $aid; ?>">Read more...</a>

This would mean $_GET would be equal to $aid

MMMWwwwwaaahhh!! I love you :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.