私信  •  关注

Manoj Kumar

Manoj Kumar 最近创建的主题
Manoj Kumar 最近回复了

不要使用DEPLICATED mysql_ux函数(PHP5.5中的DEPLICATED将在PHP7中删除)。你可以做这个 mysqli pdo

下面是完整的select查询

<?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 id, firstname, lastname FROM MyGuests";
$result = $conn->query($sql);

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