<?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

1 Comment

รับนำเข้าสินค้าจากจีน · 12/01/2025 at 03:12

… [Trackback]

[…] Information to that Topic: durukanbal.com/2021/03/16/php-mysql-pdo-connect/ […]

Leave a Reply

Avatar placeholder