当我使用 sqliteviewer 并运行时:
SELECT * FROM areas WHERE x1 <= 1 AND x2 >= 1 AND z1 <= 1 AND z2 >= 1
我得到了正确的结果,但是使用这个 php 代码我没有得到结果:
$x = 1;
$z = 1;
$sql = $this->database->prepare("SELECT * FROM areas WHERE x1 <= :x AND x2 >= :x AND z1 <= :z AND z2 >= :z");
$sql->bindValue(':x', $x, SQLITE3_INTEGER);
$sql->bindValue(':z', $z, SQLITE3_INTEGER);
$result = $sql->execute();
有人知道这段代码有什么问题吗?
编辑: 它适用于查询:
$result = $this->database->query("SELECT * FROM areas WHERE x1 <= ".$x." AND x2 >= ".$x." AND z1 <= ".$z." AND z2 >= ".$z);