2018 build news website in php

Here is a basic outline of how to build a news website in PHP:

Step 1: Plan the Website

Step 2: Set up the Development Environment

Step 3: Design the Database

Step 4: Create the Database

Step 5: Build the Front-end

Step 6: Build the Back-end

Step 7: Integrate the Front-end and Back-end

Step 8: Test and Debug

Step 9: Deploy the Website

Here is some sample PHP code to get you started:

<?php
// Connect to the database
$db = mysqli_connect("localhost", "username", "password", "database");

// Check connection
if (!$db) {
    die("Connection failed: ". mysqli_connect_error());
}

// Retrieve articles from the database
$query = "SELECT * FROM articles";
$result = mysqli_query($db, $query);

// Display the articles
while ($row = mysqli_fetch_assoc($result)) {
    echo "<h2>". $row["title"]. "</h2>";
    echo "<p>". $row["content"]. "</p>";
}

// Close the database connection
mysqli_close($db);
?>

This code connects to a MySQL database, retrieves a list of articles, and displays them on the page. Of course, this is just a very basic example, and you will need to add more functionality and features to create a fully functional news website.