如何使用PHP连接到SQLite3数据库 [英] How to connect to a SQLite3 db with PHP

查看:373
本文介绍了如何使用PHP连接到SQLite3数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是SQLite3和PHP的新手,我想知道是否以及如何使用PHP连接到SQLite3数据库.

I'm new to SQLite3 and PHP and was wondering whether and how I could connect to a SQLite3 database with PHP.

我如何从数据库中获取数据,并可以在浏览器屏幕上输出它们? 我已经在网上搜索了一段时间,但找不到任何东西.

How would I get the data from the db and would it be possible to output them on a browser screen? I've been searching the web for a while now, but couldn't find anything.

谢谢.

推荐答案

<?php
$db = new SQLite3('mysqlitedb.db');

$results = $db->query('SELECT bar FROM foo');
while ($row = $results->fetchArray()) {
    var_dump($row);
}
?>

来自此处: PHP:SQLite3 :: query-手册

这篇关于如何使用PHP连接到SQLite3数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆