Re: accessing result-set with associative array

From: Date: Sun, 30 Mar 2003 18:59:38 +0000
Subject: Re: accessing result-set with associative array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-141648@lists.php.net to get a copy of this message
It doesn't include the table name. Use name, albumid, etc. anders thoresson wrote:
Hi, I've the query "SELECT albums.name, albums.albumid, accessrights.albumid, accessrights.userid FROM albums, accessrights WHERE accessrights.userid = '$id' AND albums.albumid = accessrights.albumid". It works allright. Using the result in a html <SELECT>-tag this way works:
    while($row = mysql_fetch_array($result))     {
        echo("<OPTION VALUE=\"$row[1]\"> $row[0]");
    }
But if I tries the following line, the script fails:
    echo("<OPTION VALUE=\"$row['albums.albumid']\"> $row['albums.name']");
with the notice:        Undefined index:  'albums.albumid' in <b>c:\web\thoresson.net\include\user_functions.php</b> on line <b>24</b>
I've been trying to learn PHP for three months now, but tonight was the first time I sat down with my project for two week, so I'm sorry if I'm bothering you with something obvious that I've just forgotten. :) But I need to know: What am I doing wrong? Best regards.
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.

« previous php.general (#141648) next »