danmaxito Posted April 24, 2006 Share Posted April 24, 2006 Hello,Lets see if I can explain this one...Here goes...OK, I have a page that lists several categories (from a MySQL DB). When you click on one of the categories, you see a list of articles that pertain to that category. This is all connected with: cat_Id, cid, and art_Id.Here is what I am trying to do: Once you click on one of the categories, I want the new page that loads with the list of articles, to display what category the viewer is currently in. IN OTHER WORDS... For example: I will go to the site, click on a category, and on the new page that loads, I will see a line of text the says "You are currently in the *cat_name* category section", then I will see a list of articles.What code should I use to get the category's name? Thanks a million!!!!Danmaxito Quote Link to comment Share on other sites More sharing options...
shimano55 Posted April 24, 2006 Share Posted April 24, 2006 Have the links contain the id of the category. For instance:[code]<a href='articles.php?catId=$cats['id']'>$cats['name']</a>[/code]have $cats be an array with the DB fields and values by using a while loop in conjunction with mysql_fetch_assoc();Then on articles.php: [code]$catId = $_REQUEST['catId'];$q = mysql_query("SELECT * FROM cats WHERE id='$catId' LIMIT 1");$cat = mysql_fetch_assoc($q);echo "You are currently viewing ".$cat;[/code]Does this help?-shimano55 Quote Link to comment Share on other sites More sharing options...
danmaxito Posted April 24, 2006 Author Share Posted April 24, 2006 THANK YOU VERY MUCH!The information you gave me sure did help. I even was abe to put extra features on the page. Thanks again :)Danmaxito Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.