[英]SQLite3 query executio issue
I have a database file to which I connect through php. 我有一个通过php连接到的数据库文件。 I only want to get all the results from the particular table.
我只想从特定表中获取所有结果。 I know how to connect and query it, but for some reasons I get an array which holds only 1 result, not all the results that are stored in the table.
我知道如何连接和查询它,但是由于某些原因,我得到了一个仅包含1个结果的数组,而不是所有存储在表中的结果。 I've checked the PHP SQLite manual, and tried to follow their example.
我检查了PHP SQLite手册,并尝试遵循其示例。 But it wouldnt work.
但这是行不通的。
The table Country holds 10 rows, but i receive only 1. What's the problem? 表Country拥有10行,但我只收到1行。这是什么问题? Thanks
谢谢
$db = new SQLite3('test1.db');
if($db)
{
echo ("connected");
}
else
{
echo ("not connected");
}
$results = $db->query('SELECT * FROM Country');
echo '<br></br>';
echo sizeof($results);
=> 1
You need navigate results: 您需要导航结果:
while ($row = $results->fetchArray()) {
var_dump($row);
}
Advice: Read PHP Manual, it's very useful.... :xD 建议:阅读PHP手册,这非常有用。...:xD
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.