php连接mysql 笔记

查询

connect_error) {
    die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);
}

//MySqli Select Query
$results = $mysqli->query("SELECT user,psd FROM users");

while($row = $results->fetch_assoc()) {
echo $row["user"];
echo $row["psd"];
}  

// Frees the memory associated with a result
$results->free();

// close connection 
$mysqli->close();
?>

php连接mysql

你可能感兴趣的:(php连接mysql 笔记)