Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. <?php
  2. $dsn = 'mysql:host=localhost;dbname=;charset=UTF8';
  3. $username = '';
  4. $password = '';
  5. $options = array(
  6. PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
  7. );
  8. $dbh = new PDO($dsn, $username, $password, $options);
  9.  
  10. $stmt = $dbh->query("SELECT * FROM nyhet ORDER BY id DESC LIMIT 3");
  11. while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
  12. echo '<div class="item"><div class="text">';
  13. echo "<h2>" .$row['overskrift']. "</h2>\n";
  14. echo '<p>' . $row['shortstory']. '</p>';y
  15. echo '<a href='index2.php?id=" .$row['id'] .''>Les mer</a>";
  16. echo '</div><img src="images/bg-sldier.png" alt="The Last of us"></div>';
  17. }
  18. ?>
  19. <b>Parse error</b>: syntax error, unexpected '}' in <b>/var/www/php/show_intro.php</b> on line <b>23</b><br />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement