<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Heck's  Blog]]></title> 
<link>https://www.heckjj.com/index.php</link> 
<description><![CDATA[一瞬间的决定，往往可以改变很多，事实上，让自己成功的往往不是知识，是精神！ 如果你总是为自己找借口，那只好让成功推迟。执行力，今天！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Heck's  Blog]]></copyright>
<item>
<link>https://www.heckjj.com/php-con-sqlite3-db/</link>
<title><![CDATA[用PHP连接SQLite3数据库]]></title> 
<author>Heck &lt;@hecks.tk&gt;</author>
<category><![CDATA[Web开发]]></category>
<pubDate>Thu, 26 Aug 2010 03:45:41 +0000</pubDate> 
<guid>https://www.heckjj.com/php-con-sqlite3-db/</guid> 
<description>
<![CDATA[ 
	<textarea name="code" class="php" rows="15" cols="100">
<?php
$dsn = 'sqlite:db.s3db';//使用SQLite3数据库
try &#123;
&nbsp;&nbsp;&nbsp;&nbsp;$dbh = new PDO($dsn);//创建PDO连接
&nbsp;&nbsp;&nbsp;&nbsp;echo "PDO Connection Ok <br/>";
&nbsp;&nbsp;&nbsp;&nbsp;$dbh->exec("CREATE TABLE PKU(id integer,name varchar(255))");//创建表
&nbsp;&nbsp;&nbsp;&nbsp;echo 'Create Table ok <br/>','';
&nbsp;&nbsp;&nbsp;&nbsp;$dbh->exec("INSERT INTO PKU values(1,'jarjin')");//增加新内容
&nbsp;&nbsp;&nbsp;&nbsp;echo 'Insert Data ok <br/>','';
&nbsp;&nbsp;&nbsp;&nbsp;$dbh->beginTransaction();//回滚起始点
&nbsp;&nbsp;&nbsp;&nbsp;$sth = $dbh->query('SELECT * FROM PKU');//查询
&nbsp;&nbsp;&nbsp;&nbsp;$sth->execute();
&nbsp;&nbsp;&nbsp;&nbsp;while ($result = $sth->fetch()) &#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo $result["id"]."<br/>";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo $result["name"]."<br/>";
&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;$dsn=null;
&#125; catch (PDOException $e) &#123;
&nbsp;&nbsp; echo 'Connection failed: ' . $e->getMessage();
&nbsp;&nbsp; $dsn=null;
&#125;
?>
</textarea><br/>Tags - <a href="https://www.heckjj.com/tags/php/" rel="tag">php</a> , <a href="https://www.heckjj.com/tags/sqlite/" rel="tag">sqlite</a> , <a href="https://www.heckjj.com/tags/%25E6%2595%25B0%25E6%258D%25AE%25E5%25BA%2593/" rel="tag">数据库</a>
]]>
</description>
</item><item>
<link>https://www.heckjj.com/php-con-sqlite3-db/#blogcomment</link>
<title><![CDATA[[评论] 用PHP连接SQLite3数据库]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.heckjj.com/php-con-sqlite3-db/#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>