accessing result-set with associative array

From: Date: Sun, 30 Mar 2003 18:56:57 +0000
Subject: accessing result-set with associative array
Groups: php.general 
Request: Send a blank email to php-general+get-141646@lists.php.net to get a copy of this message
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. -- anders thoresson

« previous php.general (#141646) next »