Posted 15 March 2006 - 06:13 PM
I am running into a problem that I hope I can explain correctly.
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.
Posted 15 March 2006 - 06:16 PM
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:
$query = "SELECT * FROM Articles WHERE Category_ID = '" . $_REQUEST['catid'] . "'";
Then you just run the query and display the results as you normally would.
Hope that helps.
Info: PHP Manual
Posted 18 March 2006 - 11:58 PM
Using the same page, I want to only show 20 characters (Letters) from one of the DB columns.
How do I do that using PHP.
Posted 19 March 2006 - 12:07 AM
Posted 19 March 2006 - 02:01 AM
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!!!!
Posted 19 March 2006 - 02:29 AM
$deleteid = $_GET["deleteid"];
Posted 19 March 2006 - 02:42 AM
Posted 19 March 2006 - 02:52 AM
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)
Posted 19 March 2006 - 03:07 AM
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]?art_Id=. 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.
Posted 19 March 2006 - 03:18 AM
<td><a href="/admin/articles/viewart.php?art_Id=<?php echo $row_rsdetcat['art_Id']; ?>" >View</a></td>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.
Posted 19 March 2006 - 03:39 AM
PS: Yes, I coded this. It's a project I have for a church. Thanks
Posted 19 March 2006 - 04:01 AM
PS: I also changed the recordset that the "View" link was calling from
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users