Readmore page

Hi Guys,

I’m using this PHP code that was very kindly given to me by another member on this forum.

[php]<?php
$con = mysql_connect(“banterdonkey.db.8263933.hostedresource.com”,“banterdonkey”,“Sc13191319!”);
if (!$con)
{
die('Could not connect: ’ . mysql_error());
}

mysql_select_db(“banterdonkey”) or die(mysql_error());

// Assuming you’ve already connected to your database:
$result = mysql_query(“SELECT * FROM banter ORDER BY P_Id ASC”);
// Replace “table_name” with the name of your table.
// And replace “row_primary” with the name of the column you marked as the primary key.

while ($row = mysql_fetch_array($result)) {
echo “

”;
echo “
{$row[‘P_Id’]}
”; // Replace “column_one” with the name of your first column.
echo “
{$row[‘story’]}
”; // Replace “column_two” with the name of your second column.
echo “
{$row[‘screen_name’]}
”; // Replace “column_three” with the name of your third column.
echo “
”; // Your submit button. (adds one to each row)
echo “
”;
}

mysql_close($con);
?>[/php]

Basically I’m trying to create a forum where by all the recent stories are displayed on the homepage. This can be seen at www.banterdonkey.com and is working perfectly. My next question is when people click on the read more link how do i get a new page to load with the story and all the other details from that post? I don’t want to create a page for each story I want to use php to display everything needed from the database depending on which read more button the user clicks.

From reading around a little I think I have to use the get function but I’m not entirely sure. I want the url to appear something like this … www.banterdonkey.com/readmore.php?P_Id(number) and just replace the number with the personal Id of the story.

Can anybody offer any guidance?

Thanks

Sam

Sponsor our Newsletter | Privacy Policy | Terms of Service