如何连接到 sqlite 数据库?我打算用我的应用程序分发一个数据库,其中已经创建了所有表,所以我不需要创建一个新的数据库或表,只需分发它。
到目前为止,我有使用 mysql 的经验,我使用过类似的连接字符串
<?php session_start();
// DATABASE CONNECTION
$hostname = 'localhost';
$dbname = 'xxxxxxxxxxxx';
$username = 'xxxxxxxxxxxx';
$password = 'xxxxxxxxxxxx';
// Let's connect to host
mysql_connect($hostname, $username, $password) or DIE('Connection to host is failed, perhaps the service is down!');
// Select the database
mysql_select_db($dbname) or DIE('Database name is not available!');
?>
建立连接后,我开始使用 mysql_query 和 mysql_fetch_array 等插入 > 选择 > 删除和更新表值。
但是这个过程在 SQLITE 中有何不同。感谢所有帮助。我是sqlite的新手。