|
Posted by Jeff on 11/24/05 03:00
thanks, it works now
"Carl" <_Nospam_@_DO_NOT_.USE> wrote in message
news:138hf.23882$dO2.10617@newssvr29.news.prodigy.net...
> Jeff wrote:
>> 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
>>
>>
>
> Try :
>
> $sql = "select A.text as atext, A.link as alink, B.text as btext, B.link
> as blink, C.text as ctext,"..., etc.
>
> Then reference them by their assigned name (i.e alink/atext).
>
> Carl.
[Back to original message]
|