Thread: Tiny problem
View Single Post

  #1 (permalink)  
Old 31-01-2008, 03:55 PM
Joseph Grogan's Avatar
Joseph Grogan Joseph Grogan is offline
Wannabe Geek
 
Join Date: Jul 2007
Location: Bogland, beside birr...Cloghan
Posts: 147
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Joseph Grogan will become famous soon enough
Send a message via Skype™ to Joseph Grogan
Default Tiny problem

Hi everyone.. Ok I have a db set up that two tables in it

One called nt_posts the other nt_category

Inside nt_posts i have
  • post_id
  • post_name
  • post_content
  • category_id
and in nt_category i have
  • category_id
  • category_name
Now i have a form set up and I can select a category name to input into the category_id of the nt_posts table and it works fine as i checked it in phpmyadmin and it enters the info properly.

Now here is the problem. I have a page that outputs all the posts and on the side are category links. So when I click on a category it will only display ones with that category_id. It works when the category_id=1 but not for any other bnumber.

Here is the php code i am using to select results from seperate tables as i want to be able to say what category they selected

PHP Code:
$query "SELECT * FROM nt_post, nt_category WHERE nt_post.category_id=$category_id = nt_category.category_id=$category_id"
It works fine if i only have it selecting from one table (the nt_posts table) but then i can display the name of the category.

Any one have any ideas
Reply With Quote