Page 1 of 1

php news website

Posted: Thu Sep 29, 2011 5:08 pm
by candyman
Hello,

I am new in programming in PHP and I have small problem(for me it is big :D). I am developing one web site and in that web site users have ability to look at new news and when click on name of that news, that news needs to be opened in new page called news.php. I will show to you my code and I hope so that you will find solution for this peace of code :D

The index.php page looks like this:

<?php

$result = mysql_query("SELECT * FROM pages ORDER BY id DESC LIMIT 10");


while ($page = mysql_fetch_array($result)) {


echo "<a href=\"news.php?page=" . urlencode($page["id"]) . "\" class='news'>{$page["newsname"]}</a><br />";
echo "<h5 style=' font-size: 10px; color: black;'>{$page["date"]}</h5><hr style='margin: 5px auto 5px;' />";
}


?>
This is index page where we have list of new news!

Here is page which needs to open content of that news:
news.php
<?php
if (isset($_GET['id']))
{


$result = mysql_query("SELECT id, newsname, text FROM pages WHERE `id`='".$_GET['id']."'");
$page = mysql_fetch_array($result);

echo $page['newsname']."<br />".$page['tekst'];

}



?>

Re: php news website

Posted: Thu Sep 29, 2011 8:43 pm
by Celauran
What isn't working?

Re: php news website

Posted: Fri Sep 30, 2011 3:23 am
by candyman
I do not know, they cannot produce output to the web page.