Forum Moderators: coopster
I tried adding code so that I could get to the columns of the returned rows. I took the example at www.php.net/manual/en/ref.mysql.php and tried modifying it so i could address specific columns from the results
the connection and all prior work. Its trying to address the columns that has problems.
the names of my columns are 'auction_no' and 'tracking_no'
this is what i did and it doesn't work:
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
echo "\t\t<td>$line['auction_no']</td><td>$line['tracking_no']</td>\n";
echo "\t</tr>\n";
}
Should I post the whole script?
Thanks in advance
This has to do with the method that PHP interprets arrays. It would actually be acceptable to not put quotation marks around the keys within the brackets in this case since the entire statement itself is a string (enclosed in double-quotes) and constants are not looked for within strings. However, that can get confusing, so I tend to use the braces syntax. Variable assignment or concatenation are also viable alternatives.
More information on how this works is found in the manual under Array do's and don'ts [php.net]. Read through the " More examples to demonstrate this fact:" section for details.