Jump to content

Please help


danmaxito

Recommended Posts

Hello everyone. I have been checking this site out a lot, and decided to join the forum team.

I am running into a problem that I hope I can explain correctly.

Here goes:

I have 2 tables ("Articles" and "Categories"). On the index.php page I display all the categories (which can be "Edited", and "Deleted"). The categories are linkable, and once you link on one, it will show you all the articles that are listed under that category (and each article can be "Edited" and "Deleted").

Once I click on a category from the index page, the category ID is passed on the URL, but I do not know how to tell PHP to only show the artciles in that category....

I am also VERY open to suggestions on other was of completing this small project.


THANKS A MILLION IN ADVANCE.

Danmaxito
Link to comment
Share on other sites

I'm going to assume a few things:

1) That you're storing the Category ID in the Articles Table with each article.
2) You're already using SELECT SQL statements to grab the data.

If those 2 things are correct, all you need to do is know how to use a WHERE clause in your SQL statement:
[code]$query = "SELECT * FROM Articles WHERE Category_ID = '" . $_REQUEST['catid'] . "'";[/code]

Then you just run the query and display the results as you normally would.

Hope that helps.
Link to comment
Share on other sites

thanks..It is working now.

I am really confused (lost).
Once the admin click on a category, all the articles within that category are listed on a new page. By each article I have "edit","Delete" buttons. I used the code that Ober gave me... and I got that to work. But when the new page loads displaying all the articles in the category that the admin clicked on, I can't get the buttons by each category to work right. It just loads a blank screen, and does not pass the articles ID. How can I get this to work.

I really appreciate the help that you guys are giving me!!!!
Link to comment
Share on other sites

[a href=\"http://www.lancasterpaintingco.com/admin/articles/index.php\" target=\"_blank\"]Here is the link[/a]

The login info is : demo/demo

you will first be taken to a login page... then after you login, you will be redirected to the article page. You will see a list of categories for a church. Click on the "prayer" category (click on the word). Then you will see a new page with all the articles under that category. Next to each article are the modification buttons. I disabled all of them except for "View" which will open up a new page (suppose to grab the ID of the article clicked on) and show anything within that article.

Does this make sense?

I basically need to know how to pass the ID of the article to the Modification page (Edit, Delete, view, etc)
Link to comment
Share on other sites

Well first, does all articles have an ID of some sort?

I noticed it goes to [a href=\"http://www.lancasterpaintingco.com/admin/articles/viewart.php\" target=\"_blank\"]http://www.lancasterpaintingco.com/admin/a...les/viewart.php[/a][b]?art_Id=[/b]. After the art_Id= should be the article ID you want to be looking at.

Can I please see the source of [a href=\"http://www.lancasterpaintingco.com/admin/articles/viewart.php?art_Id=\" target=\"_blank\"]http://www.lancasterpaintingco.com/admin/a...art.php?art_Id=[/a] and [a href=\"http://www.lancasterpaintingco.com/admin/articles/catdetail.php?cat_Id=1\" target=\"_blank\"]http://www.lancasterpaintingco.com/admin/a...il.php?cat_Id=1[/a] ? I don't know where you are in the script right now.
Link to comment
Share on other sites

[code]
          <td><a href="/admin/articles/viewart.php?art_Id=<?php echo $row_rsdetcat['art_Id']; ?>" >View</a></td>[/code] in catdetails.php is where the article is being passed to viewart.php. Make sure there is a field in your MySQL table named "art_Id" and with the proper information.


P.S. Did you code this by yourself? I am very impressed! Not to mention that my family is a very religous one.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.