Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $con = mysqli_connect('localhost', 'root', 'root', 'test_bjorn');
- $sqlGetArticles = "SELECT * FROM `articles` ORDER BY `id` DESC LIMIT 0,10";
- $resultGetArticles = mysqli_query($con, $sqlGetArticles);
- $index = 0;
- while ($objectGetArticles = mysqli_fetch_assoc($resultGetArticles))
- {
- $index += 1;
- if ($index == 1)
- {
- //Stor nyhet (første)
- $indexString = 'Stor nyhet';
- } else
- {
- //Liten nyhet (resten)
- $indexString = 'Liten nyhet';
- }
- echo '
- <h3>' . $indexString . '</h3>
- <ul>
- <li><span style="font-weight: bold;">Title: </span> ' . $objectGetArticles['title'] . '</li>
- <li><span style="font-weight: bold;">Forfatter: </span> ' . $objectGetArticles['author'] . '</li>
- <li><span style="font-weight: bold;">Innhold: </span> ' . $objectGetArticles['content'] . '</li>
- </ul>
- ';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment