magicmoose Posted March 5, 2007 Share Posted March 5, 2007 I think I have the right idea with this code, I am just unsure of the correct syntax to use. The following is meant to simply arrange the results of a query in a table. However, I would like the first field of each row to echo as a unique hyperlink (based on $dbRecord["title"]) which can then be passed on to another page with GET. while ($dbRecord=mysql_fetch_array($queryResult)) { echo "<TR><TD><A href=\"comic.php?title=$dbRecord["title"]\">".$dbRecord["title"]."</A></TD>"."<TD>".$dbRecord["author"]."</TD>"."<TD>".$dbRecord["artist"]."</TD>"."<TD>".$dbRecord["publisher"]."</TD></TR>"; I know I have made a syntax error as I cannot get this to work yet, but are there any other problems with this? Any help would be greatly appreciated, thanks! Quote Link to comment Share on other sites More sharing options...
jcbarr Posted March 5, 2007 Share Posted March 5, 2007 You haven't closed your { } for starters. Other then that I'm not sure yet. Enclose it in php tags on the board and it should highlight it for you which will help. <?php while ($dbRecord=mysql_fetch_array($queryResult)) { echo "<TR><TD><A href=\"comic.php?title=$dbRecord["title"]\">".$dbRecord["title"]."[/url]</TD>"."<TD>".$dbRecord["author"]."</TD>"."<TD>".$dbRecord["artist"]."</TD>"."<TD>".$dbRecord["publisher"]."</TD></TR>"; } ?> Quote Link to comment Share on other sites More sharing options...
magicmoose Posted March 5, 2007 Author Share Posted March 5, 2007 Sorry, I have closed the tags, I just cut and pasted 1 line less than I should Quote Link to comment Share on other sites More sharing options...
jcbarr Posted March 5, 2007 Share Posted March 5, 2007 From the color coding above you should see where your error is; comic.php?title=$dbRecord["title"] Quote Link to comment Share on other sites More sharing options...
willpower Posted March 5, 2007 Share Posted March 5, 2007 you have double open quotes that are unescaped. You haven't closed your { } for starters. Other then that I'm not sure yet. Enclose it in php tags on the board and it should highlight it for you which will help. <?php while ($dbRecord=mysql_fetch_array($queryResult)) { echo "<TR><TD><A href=\"comic.php?title=$dbRecord["title"]\">".$dbRecord["title"]."[/url]</TD>"."<TD>".$dbRecord["author"]."</TD>"."<TD>".$dbRecord["artist"]."</TD>"."<TD>".$dbRecord["publisher"]."</TD></TR>"; } ?> Look at the colors. You will see the blue in the echo statement. this needs tro be fixed. Quote Link to comment Share on other sites More sharing options...
willpower Posted March 5, 2007 Share Posted March 5, 2007 he types faster than me!!! Quote Link to comment Share on other sites More sharing options...
magicmoose Posted March 5, 2007 Author Share Posted March 5, 2007 Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.