php查询数据库的奇怪问题
数据库中有两个表,分别为group与person,都只有一条记录(确认都有一条记录)
通过以下语句查询数据库:$mysqli = new mysqli("127.0.0.1", "root", "123456", "testdb");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "select * from person";
if ($result = $mysqli->query($query)) {
while ($obj = $result->fetch_assoc()) {
printf ("%s (%s)\n", $obj["idPerson"], $obj["idPerson"]);
}
$result->close();
}
$mysqli->close();查询结果能够正确显示,但是通过select * from group查询group表,就查不到数据
数据库中有两个表,分别为group与person,都只有一条记录(确认都有一条记录)
通过以下语句查询数据库:$mysqli = new mysqli("127.0.0.1", "root", "123456", "testdb");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "select * from person";
if ($result = $mysqli->query($query)) {
while ($obj = $result->fetch_assoc()) {
printf ("%s (%s)\n", $obj["idPerson"], $obj["idPerson"]);
}
$result->close();
}
$mysqli->close();查询结果能够正确显示,但是通过select * from group查询group表,就查不到数据
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货