I have a DETAILS.PHP page which has two quieries: (1) for the table called 'articles' and (2) for the 'related_articles'. I need the 'related_articles' to query the database for records that have the 'title' of the query before.
This is what happens...
From the INDEX.PHP, the user sees a list of articles (titles of the articles). The user clicks on the particular article they wish to view and the page goes to DETAILS.PHP and displays the selected record's details. Also, on this page I want a list of "Related Links". The 'related_articles' basically takes the 'title' field of the displayed record and queries the 'articles' table with it.
What is the string for the 'related_articles' query?
Related Records
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
It's difficult to write an SQL statement when you have no idea how the database table's are set up. But assuming that you have the 'title' field of the record you are showing stored in a variable (e.g. $title):
Is this the kind of thing you are looking for?
Mac
Code: Select all
SELECT field1, field2, field3 FROM articles WHERE somefield = '$title'Mac