<?php

    $mysqli = new mysqli("localhost", "my_user", "my_password", "DBName");

    /* check connection */
    if ( mysqli_connect_errno() )
    {
        printf("Connect failed: %s\n", mysqli_connect_error());
        exit();
    }

    if ( $result = $mysqli->query ("SELECT * FROM Users") )
    {
        foreach ( $result->fetch_row() as $data )
        {
            echo $data;
        }
        
        $result->close();
    }

    $mysqli->close();

?>
Categories: PHP language

288 Comments

Leave a Reply

Avatar placeholder