News sorted by category problem.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zoidberg
Forum Newbie
Posts: 4
Joined: Sat May 22, 2004 11:31 am
Location: Canada

News sorted by category problem.

Post 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
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post 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.
zoidberg
Forum Newbie
Posts: 4
Joined: Sat May 22, 2004 11:31 am
Location: Canada

Post by zoidberg »

yeah, like I said, it was a n00b question.

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