Joseph Grogan
New Member
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
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
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
One called nt_posts the other nt_category
Inside nt_posts i have
- post_id
- post_name
- post_content
- category_id
- category_id
- category_name
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:
$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