0

I am fairly new at PHP and I trying to make the 'ID' field in my HTML table clickable as link to echo a profile page. I'd like to know whats wrong with this code as I copied it straight from another Stack Overflow thread that was voted up.

Hyperlinks within a table - '<a href="">'.$row['username'].'</a>'

What's the proper term for what I am trying to do so I can research it?

 while($row = mysql_fetch_row($result))
                    {
                        echo "<tbody>";
                        echo "<tr>";

                        echo "<td><a href="profile.php?user='.$row['0'].'"></a></td>";
                        echo "<td>$row[1]</td>";
                        echo "<td>$row[2]</td>";
                        echo "<td>$row[3]</td>";
                        echo "<td>$row[4]</td>";
                        echo "<td>$row[5]</td>";
                        echo "<td>$row[6]</td>";
                        echo "<td>$row[7]</td>";

                        echo "</tr>";
                        echo "</tbody>";

                    }
                    mysql_free_result($result);
                    ?>
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Mathew
  • 45
  • 1
  • 6
  • 1. *I copied it straight from Wschool* From where did you copied that? 2. Your concatenation is wrong – Rizier123 Jun 11 '15 at 20:26
  • @anantkumarsingh Oh I don't even want to count how many times I already gave you the information, that OP gets a notification for each answer. (Slowly I believe you just don't want to listen, which I then will end up just flagging your comments as too chatty) – Rizier123 Jun 11 '15 at 20:29
  • As it seems like you're getting a bit confused with all these single and double quotes and you are mixing them up. It's not difficult. If you want to concatenate your string, you have to determinate it and use `.`, e.g. `echo "someValueToClickOn";` – Rizier123 Jun 11 '15 at 20:46
  • @Rizier123 Works Fantastic Thank You. Make it And awnser and I will vote is as the 'accepted awnser'. Thanks again – Mathew Jun 11 '15 at 20:54
  • I won't write an answer for it, because the dupe shows you exactly, how concatenation works and how you have to concatenate strings. (But I'm glad I could help you) – Rizier123 Jun 11 '15 at 20:55

0 Answers0