[Solved] How do I import info from a database to my website? [closed]


$query = “SELECT * FROM ‘users'”;

<?php
    $servername = "localhost";
    $username = "username";
    $password = "password";
    $dbname = "myDB";

    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);

    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }

    $sql = "SELECT * FROM users";
    $result = $conn->query($sql);

    if ($result->num_rows > 0) {
        // output data of each row
        while($row = $result->fetch_assoc()) {
            echo "id: " . $row["id"];
        }
    } else {
        echo "0 results";
    }
    $conn->close();
?> 

3

solved How do I import info from a database to my website? [closed]