news system...
Moderator: General Moderators
news system...
i have written a fairly simple news system, allows users to edit/delete/add news.
everything works well..except for one thing - i want to be able to view a specific news topic by quering thepage.php?something=NEWSID and have that display a specific news-ID...not all of the news..now i have it so that all of the news (max 10 topics) shown on the index page...
anyone got any simple code for doing something i want?
-- teksys
everything works well..except for one thing - i want to be able to view a specific news topic by quering thepage.php?something=NEWSID and have that display a specific news-ID...not all of the news..now i have it so that all of the news (max 10 topics) shown on the index page...
anyone got any simple code for doing something i want?
-- teksys
i don't really understand what you are on about but here it is if you are useing DB:
to get ID etc do this:
then put this on another page.
and to print it all you have to do is:
i just wrote this right here so i dobn't know if anything is worng with it.
just post back here if there is.
hope this helps.
to get ID etc do this:
Code: Select all
<?php
$sql = "SELECT ID, etc FROM tablename";
$results = mysql_query($sql);
while(list($ID,etc) = mysql_fetch_row($results))
{
Print("<a href='?id=$ID'>etc</a><br>");
}
?>Code: Select all
<?php
if(IsSet($id)
{
}
else
{
$id="1"; //if id is not with the page name then it it will show the first news in the DB
}
$sql = "SELECT ID, etc FROM tablename WHERE ID='$id';
$results = mysql_query($sql);
$get = mysql_fetch_array($results);
?>Code: Select all
print("$getїfieldname]");just post back here if there is.
hope this helps.
really depends on how you store the data. I use flatfiles all the time and the way I do it is to use a single line for each article, then tell the script to only load one at a time.
Maybe this script I wrote can give you some ideas. http://www.alienhelpdesk.com/freescripts.php?id=16
Maybe this script I wrote can give you some ideas. http://www.alienhelpdesk.com/freescripts.php?id=16
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
well, you could use this script i wrote for my site, i use it my self:
http://www.qadsscripts.t2u.com
PHPNews is the script name.[/url]
http://www.qadsscripts.t2u.com
PHPNews is the script name.[/url]