Page 1 of 1

News sorted by category problem.

Posted: Sat May 22, 2004 11:31 am
by zoidberg
Hey guys.. I have kind of a n00b question here, but I've scoured the net for days reading tutorial after tutorial and haven't found a clear answer.

I'm trying to set up a sort of links page, sorted by various categories

ie:

Section Title

link
link
link
link

Each link pulling an article out of the db.

What I'm wondering is, do I need 2 tables, one for the article and one for the titles? I can do a select * from table by category, but I don't want the article showing in the above space...

I'd like each link to open a pop up containing the article, pulled out of the local db. I'm just not sure of the best method to create the links... getting the info into the db is no problem, but I want all titles displayed in their own box linking to the full story etc.

I'm not asking anyone to write the code for me, just for tips, or a link to a decent tutorial that might help.

Thanks a lot.

Zoid

Posted: Sat May 22, 2004 11:36 am
by kettle_drum
You can just have a sql table that holds:

article_id
article_title
article_author
article

etc.

Then on the first page you simply select the title and id of the article and use these in the link:

Code: Select all

<a href="show.php?id=$id_from_database">$title_from_database</a>
Then on the page to show the article, grab the id from the url, use this in your database query, and display the article that corosponds to that id.

Posted: Sat May 22, 2004 12:10 pm
by zoidberg
yeah, like I said, it was a n00b question.

Thanks for the info.. now to try and make it work 8O