当我使用mysql时,一切运行良好,但由于我改为mysqli,它根本不起作用。我连接我没有得到我整天尝试过的数据库。
$u_name = $_SESSION['username'];
$conn=mysqli_connect($mysql_server, $mysql_username, $mysql_password,
$mysql_table) or die("<h2>Connection Failed</h2>");
mysqli_select_db($conn, $mysql_table);
$query="SELECT * FROM users WHERE username='{$_SESSION['username']}'
limit 1";
$result = mysqli_query($conn, "SELECT * FROM users WHERE
username='{$_SESSION['username']}' limit 1") or
die(mysqli_error($conn));
if($result->connect_errno > 0){
die('error [' . $db->connect_error . ']');
}
$data = mysqli_fetch_array( $result );
$id=$data['id'];