Hi all,
Hope you can help.
What I am trying to do:
Bascially I have a table (id, title, subtitle, article)
I am trying to display title, subtitle on one page, and when you click on title, you are taken to another page that displays title, subtitle, article.
Here is what I have so far:
test.php - This works
Code: Select all
<?php
$conn = mysql_connect("80.94.196.33","","") or trigger_error("SQL", E_USER_ERROR);
$db = mysql_select_db('bssql',$conn) or trigger_error("SQL", E_USER_ERROR);
$result = mysql_query ("SELECT id, title, subtitle, article FROM articles ORDER BY ID DESC");
while(list($id, $title, $subtitle, $article) = mysql_fetch_row($result))
{
echo " <a href='test1.php?currentpage=$id'>$title</a><BR />";
echo $subtitle;
echo "<BR />";
echo "<BR />";
}
?>Code: Select all
<?php
// database connection info
if (isset ($_GET['currentpage']))
$currentpage = $_GET['currentpage'];
$conn = mysql_connect("80.94.196.33","") or trigger_error("SQL", E_USER_ERROR);
$db = mysql_select_db('bssql',$conn) or trigger_error("SQL", E_USER_ERROR);
$result = mysql_query ('SELECT title, subtitle, article FROM articles WHERE id = "' . $id . '"');
while(list($id, $title, $subtitle, $article) = mysql_fetch_row($result))
{
echo $title;
echo "<BR />";
echo $subtitle;
echo "<BR />";
echo nl2br($article);
echo "<BR />";
}
?>Many thanks Gem
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: