四、mysqli连接数据库

connect_error) die($conn->connect_error);
mysqli_query($conn,"SET NAMES 'utf8'");
$query = "select telephone,realname,idcard,credit6 from ims_mc_members where uid=855";
$result = $conn->query($query);

$row = $result->fetch_assoc();
print_r($row);
die;
$data = array();
if($result){
$data['telephone'] = $result['telephone'];
$data['realname'] = $result['realname'];
$data['idcard'] = $result['idcard'];
$data['credit6'] = $result['credit6'];
var_dump($data);
}else
{
die(mysqli_error($conn));
}

你可能感兴趣的:(四、mysqli连接数据库)