Everytime I use $rows['id'] and the like, I get this error:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/darkpro/public_html/links/links.php on line 13
.....I'm feeling really dumb right now for not being able to get this. The only upside is that I'm doing this to learn more about PHP/MySQL. New code, minus the ['id'] change.
Code:
<?php
$db = mysql_connect("localhost","darkpro_various","fRAbr5d2");
mysql_select_db ("darkpro_various");
$result = mysql_query("SELECT l.id, l.cat, l.url, l.title, l.date, l.hits, c.id, c.name FROM links l LEFT JOIN links_cat c ON c.id = l.cat WHERE l.cat=c.id");
echo "<table border='1' align='center'>";
echo "<th>ID#</th><th>Catagory</th><th>Link</th><th>Date</th><th>Hits</th>";
while ($rows = mysql_fetch_array($result))
{
echo "<tr><td>$rows[l.id]</td><td>$rows[l.cat]</td><td><a href=out.php?id=$rows[l.id]>$rows[l.title]</a></td><td>$rows[l.date]</td><td>$rows[l.hits]</td></tr>";
}
echo "</table>";
?>
And the error it produces:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in /home/darkpro/public_html/links/links.php on line 13
Line 13 is obviously the while loop echo line. I've tried both c.name and l.cat for the catagory name with no visible effect on the error.