Jump to content

[SOLVED] Need some help with syntax


magicmoose

Recommended Posts

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

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>";
}
?>

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.