Many thanks I got there in the end and it's all working for me now.
Code: Select all
SELECT latest_news.newsId
, latest_news.newsDate
, latest_news.newsHeadline
, latest_news.newsStory
, news_links.linkId
, news_links.newsId
, news_links.newsLink
FROM latest_news
LEFT JOIN news_links
ON latest_news.newsId = news_links.newsId
WHERE latest_news.newsId = var1
var1 = $_GET['newsId']
I now have a page that retrievs the newsId passed through the URL, matches it to the newsId column in the 'latest_news' table, the page displays all of the latest news according to the headline that was clicked in the previous page (the link that passes the variable). I have also LEFT JOINed another table called 'news_links' which displays all of the links for that news story, based on the newsId.
Many thanks to you guys for your help.
I'll try be a bit more efficient in my question asking next time, and now I've read through the docs in the useful links stickys I'll be a better equipped for this place!
Cheers,
Jonathan
P.S. For future reference, do MySQL questions go in this forum or in the PHP code forum?