You are here: newbie: accessing columns in a select « PHP Language « IT news, forums, messages
newbie: accessing columns in a select

Posted by Jeff on 11/24/05 02:18

php version 5

Here is some code from index.php:
$sql = "select A.text, A.link, B.text, B.link, C.text, C.link from menu A,
menu B left outer join menu C on B.MenuItemID = C.parent where B.parent =
A.MenuItemID and A.MenuItemID = $MenuItem";

$result = $dbh->query($sql);
while ($menuitem = $result->fetch_assoc())
{
echo "<a href={$menuitem['Link']}>{$menuitem['text']}</a>";
echo "<br>";
}

As you can see from my select, I've joined the menu table with itself 3
times...My problem is in this line:
echo "<a href={$menuitem['A.Link']}>{$menuitem['A.text']}</a>";

I cannot access the columns in the resulset using A.Link, A.text, B.Link
etc... But I want to access them, how do I access the columns here?

Please, help me with this problem!


Jeff

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация