Why can't I display values from three joined tables?

I’m using the following query to join two tables, extracting a number of values (e.g page title) and displaying an article from the field AI.Article…


 $Zext = mysql_fetch_assoc(mysql_query("SELECT GZ.N, GZ.URL, GZ.Title, GZ.Subtitle,
  GZ.Parent, GZ.Live, AI.URL, AI.Article
  FROM gz_topics GZ
  LEFT JOIN gz_articles_topics_intro AI ON AI.URL = GZ.URL
  WHERE GZ.URL LIKE '$MyURL' AND GZ.Live = 1"));

It works fined. But when I put my articles in three separate tables, I can’t display the article…


 $Zext = mysql_fetch_assoc(mysql_query("SELECT GZ.N, GZ.URL, GZ.Title, GZ.Subtitle,
  GZ.Parent, GZ.Live, Art.URL, Art.Article, AI.URL, AI.Article,  AN.URL, AN.Article
  FROM gz_topics GZ
  LEFT JOIN gz_articles_topics Art ON Art.URL = GZ.URL
  LEFT JOIN gz_articles_topics_intro AI ON AI.URL = GZ.URL
  LEFT JOIN gz_articles_topics_names AN ON AN.URL = GZ.URL
  WHERE GZ.URL LIKE 'Birds' AND GZ.Live = 1"));

I pasted the query into SQL, and it works fine; it displays the article I’m trying to display on my page. So why can’t I display the article on my page?

This is the code I’m using to display database values:


$Article = $Zext['Article'];
echo $Article;

Thanks.

Hi
The problem can be that you have 3 returned ‘Article’ index couse of this in sql query: “… Art.Article, AI.Article, AN.URL, AN.Article …”.
Try add them an alias, like this:
“… Art.Article as article_art, AI.URL, AI.Article as article_ai, AN.URL, AN.Article …”

I see. Thanks for the help.

I believe if you label each of the articles with a unique AS name you will be able to separate the results by this unique name

Art.Article as ArtArticle,
AI.Article as IntroArticle,
AN.Article as NameArticle

etc