bpat1434,
<?php
// Connect to the database and select which database we want to use first.
$db = mysql_connect("server", "username", "password") or die(mysql_error());
mysql_select_db("dbname", $db) or die(mysql_error());
if(!isset($_GET['articleid']) || empty($_GET['articleid']))
{
$get = mysql_query("SELECT * FROM tbl_name") or die(mysql_error());
while($row = mysql_fetch_array($get))
{
// Declare your variables in here
$id = $row['ID'];
$title = $row['title'];
$date = $row['date'];
$article = $row['article'];
echo("<a href='http://mydomain.com./about2/news.php?articleid=3'>$title</a><br>");
}
}
else
{
$get = mysql_query("SELECT * FROM article_news WHERE ID='".$_GET['articleid']."' LIMIT 1");
$info = mysql_fetch_array($get);
// Display a link to the article index :)
echo '<a href="'.$_SERVER['PHP_SELF'].'">Back to Article Index</a><hr>';
echo $info['article'];
}
?>
The only thing I've changed in your code,
I ommited the,
echo("<b>$info['title']</b><br />");
in the line before last, in the code that you gave me, 'cause it was giving me a parse error.
Well, it's starting to work partially.
Now, check this out:
http://www.greencyberfans.com./about2/news.php
As you'll see here we have three different links.
Actually there are three different rows (articles) in the table in the db, with different id's: "3" for "roots" "6" for "history" and "9" for "photos".
These are the id numbers in the db.
BTW, the "back to Articles" link, works right. It takes you back to the link page.
When you click on "roots", you get the correct response.
When you click on "history" and "photos" not only you don't get the correct articles which in this case would be "history"(6) and "photos"(9), but you get the same article: "roots", on all three links.
You also get the same "id", which in this case is "3", for all three links or articles ('cause that's what they are, articles or rows on the table in the db).
This is what I can't figure out. How to get these links to retrieve the correct articles. SE-PE-RA-TE-LY AND WITH THE CORRECT ID.
What do I have to do to achieve that?
If you wanna help, please be specific.
One more thing I've changed in your code besides, server username and ps,
is the id number on the echo. I put number "3":
echo("<a href='http://mydomain.com./about2/news.php?articleid=3'>$title</a><br>");
Thank you in advance, partner!