我使用以下脚本获取该帐户的加入:
$date = mysqli_query($conn,"SELECT joindate from account where id = 6");
该查询的结果应该是2016-01-30 00:00:00,但是当我使用
时print_r($date);
我只得到
mysqli_result Object ( [current_field] => 0 [field_count] => 1 [lengths] => [num_rows] => 1 [type] => 0 )
答案 0 :(得分:4)
因为mysqli_query
只是执行您的查询。
您需要的数据应获取,例如使用mysqli_fetch_assoc
功能。
$date = mysqli_query($conn,"SELECT joindate from account where id = 6");
print_r(mysqli_fetch_assoc($date));
如果您希望结果有多行,请使用while
循环:
while ($row = mysqli_fetch_assoc($date)) {
print_r($row);
}