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! Link to comment https://forums.phpfreaks.com/topic/41328-solved-need-some-help-with-syntax/ 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>"; } ?> Link to comment https://forums.phpfreaks.com/topic/41328-solved-need-some-help-with-syntax/#findComment-200244 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 Link to comment https://forums.phpfreaks.com/topic/41328-solved-need-some-help-with-syntax/#findComment-200246 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"] Link to comment https://forums.phpfreaks.com/topic/41328-solved-need-some-help-with-syntax/#findComment-200250 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. Link to comment https://forums.phpfreaks.com/topic/41328-solved-need-some-help-with-syntax/#findComment-200252 Share on other sites More sharing options...
willpower Posted March 5, 2007 Share Posted March 5, 2007 he types faster than me!!! Link to comment https://forums.phpfreaks.com/topic/41328-solved-need-some-help-with-syntax/#findComment-200254 Share on other sites More sharing options...
magicmoose Posted March 5, 2007 Author Share Posted March 5, 2007 Thanks! Link to comment https://forums.phpfreaks.com/topic/41328-solved-need-some-help-with-syntax/#findComment-200263 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.