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

 

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.