you'll need to use $_GET['id'] or you'll need to set register_globals = On.
I would use the first method, and replace $query = "SELECT slug, content, contact, timestamp FROM news WHERE id = '$id'"; with --> $query = "SELECT slug, content, contact, timestamp FROM news WHERE id = '". $_GET['id']."'"; i bet it will work straight away. hth Jeff [EMAIL PROTECTED] on.co.uk To: [EMAIL PROTECTED] cc: 07/15/2003 10:44 Subject: [PHP-DB] PHP MySQL news display probs AM Dear All, I have created a simple news system and am having a problem in that all the code compiles so I think it is correct and the news headlines display but when you point to the link to read the article (for example http://localhost/news/user/story.php?id=2) nothing displays, it returns that there is nothing in the database and prints out the arm of the else statement, no records. I am convinced that I need to enable something somewhere in the php.ini file but may be wrong. Any help would be really really appreciated. This is the code which displays the news headlines which displays them OK: <html> <head> <basefont face="Verdana"> </head> <body> <!-- standard page header begins --> <p> <p> <table width="100%" cellspacing="0" cellpadding="5"> <tr> <td></td> </tr> <tr> <td bgcolor="Navy"><font size="-1" color="White"><b>Reuters Inc : Press Releases</b></font></td> </tr> </table> <!-- standard page header ends --> <ul> <? // includes include("../conf.php"); include("../functions.php"); // open database connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // generate and execute query $query = "SELECT id, slug, timestamp FROM news ORDER BY timestamp DESC LIMIT 0, 5"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // if records present if (mysql_num_rows($result) > 0) { // iterate through resultset // print article titles while($row = mysql_fetch_object($result)) { ?> <li><font size="-1"><b><a href="story.php?id=<? echo $row->id; ?>"><? echo $row->slug; ?></a></b></font> <br> <font size="-2"><? echo formatDate($row->timestamp); ?></font> <p> <? } } // if no records present // display message else { ?> <font size="-1">No press releases currently available</font> <? } // close database connection mysql_close($connection); ?> </ul> <!-- standard page footer begins --> <p> <table width="100%" cellspacing="0" cellpadding="5"> <tr> <td align="center"><font size="-2">Everything here is copyright © </tr> </table> <!-- standard page footer ends --> </body> </html> This is the code to Display the corresponding article, its driving me nuts! / story.php - display contents of selected press release ?> <html> <head> <basefont face="Verdana"> </head> <body> <!-- standard page header begins --> <p> <p> <table width="100%" cellspacing="0" cellpadding="5"> <tr> <td></td> </tr> <tr> <td bgcolor="Navy"><font size="-1" color="White"><b>Reuters Inc : Press Releases</b></font></td> </tr> </table> <!-- standard page header ends --> <? // includes include("../conf.php"); include("../functions.php"); // open database connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // generate and execute query $query = "SELECT slug, content, contact, timestamp FROM news WHERE id = '$id'"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // get resultset as object $row = mysql_fetch_object($result); // print details if ($row) { ?> <p> <b><? echo $row->slug; ?></b> <p> <font size="-1"><? echo nl2br($row->content); ?></font> <p> <font size="-2">This press release was published on <? echo formatDate ($row->timestamp); ?>. For more information, please contact <? echo $row->contact; ?></font> <? } else { ?> <p> <font size="-1">That press release could not be located in our database.</font> <? } // close database connection mysql_close($connection); ?> <!-- standard page footer begins --> <p> <table width="100%" cellspacing="0" cellpadding="5"> <tr> <td align="center"><font size="-2">Everything here is copyright © </tr> </table> <!-- standard page footer ends --> </body> </html> Thanks Again PHPUSER -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php