我发现使用与pdo相同的有趣行为。我检查了phpmyadmin和pdo中的几个select语句,结果各不相同。有人有什么想法吗?
$sql = "select * from fenster where fenster > 'news'"; //works ok
$sql = "select * from fenster where fenster < 'news'"; //works ok
$sql = "select * from fenster where fenster <= 'news'"; //works ok
$sql = "select * from fenster where fenster >= 'news'"; // news is not in result
$sql = "select * from fenster where fenster = 'news'"; // news is not in result
$stmt = $db->prepare($sql);
$stmt->execute();
$ feldName = array_keys($ stmt-&gt; fetch(PDO :: FETCH_ASSOC));
while($data = $stmt->fetch()) {
var_dump($data);
}
答案 0 :(得分:0)
我自己找到了原因。 $ feldName = array_keys($ stmt-&gt; fetch(PDO :: FETCH_ASSOC));确实读过了丢失的行,所以之后没有显示。所以我必须找到一种解决方法。