Guest User

Untitled

a guest
Jan 15th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. <?php
  2. $host="localhost"; // Host naam
  3. $username="root"; // Mysql login naam
  4. $password=""; // Mysql wachtwoord
  5. $db_name="marketplace"; // Database naam
  6. $tbl_name="stageplek"; // Table naam
  7.  
  8. // Verbinding maken met de server en de database selecteren.
  9. mysql_connect("$host", "$username", "$password")or die("cannot connect");
  10. mysql_select_db("$db_name")or die("cannot select DB");
  11.  
  12. $sql="SELECT * FROM $tbl_name ORDER BY id ASC";
  13. // OREDER BY id ASC is het orderen van de id's van laag naar hoog.
  14. $result=mysql_query($sql);
  15. ?>
  16.  
  17. <table width="40%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
  18. <tr>
  19. <td width="6%" align="center" bgcolor="#E6E6E6"><strong>#</strong></td>
  20. <td width="34%" align="center" bgcolor="#E6E6E6"><strong>Titel</strong></td>
  21. </tr>
  22. <?php
  23. while($row = mysql_fetch_array($result))
  24. {
  25. echo "<tr>";
  26. echo "<td>" . $row['id'] . "</td>";
  27. echo "<td>" . $row['titel'] . "</td>";
  28. echo "<td><a href=\"view_topic.php?id= . $row['id'] . \"> . $row['titel']; .</a></td>";
  29. echo "</tr>";
  30. }
  31. echo "</table>";
  32.  
  33. ?>
  34.  
  35. <table align="center" >
  36. <tr>
  37. <td colspan="5" align="center" bgcolor="#E6E6E6"><a href="topic_maken.php"><strong>Create New Topic</strong> </a></td>
  38. </tr>
  39. </table>
  40.  
  41. gives the error:
  42. Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\Forum\forum_index.php on line 28
  43.  
  44. The line that doesnt work:
  45. echo "<td><a href=\"view_topic.php?id= . $row['id'] . \"> . $row['titel']; .</a></td>";
  46.  
  47. Need to show the topic title and that u can click on it. It will take you to a page with that topic title id.
Add Comment
Please, Sign In to add comment