Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (3) </ 1 [2] 3 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: php and sqlite, does php.tar.gz provide sqlite support ?< Next Oldest | Next Newest >
Max Offline





Group: Members
Posts: 211
Joined: July 2004
Posted: Oct. 22 2004,16:40 QUOTE

I'm sure you found this, but just in case:

Article:
SQLite Support for PHP4
http://www.phpbuilder.com/columns/farell20040824.php3


--------------
Using DSL on: IBM T42, IBM 560x, Dell Dimension CPx
Back to top
Profile PM 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Oct. 22 2004,19:27 QUOTE

Hmmm, what to do.  I just tested my old sqlite.php, a 201 line php script that provides an interface to sqlite. Actually I found something on the net way back in November 2001. I added many functions to emulate what was being used in the then current php to talk to mysql. So, it has:
  sqlite_query
  sqlite_fetch_row
  sqlite_fetch_array
  sqlite_num_rows
  sqlite_num-cols
  sqlite_field_name
  sqlite_col_names
Anyway, it seems to work with the current php.tar.gz and sqlite in DSL.
The problem I see is in any support that may be needed. I wrote these function on 11/27/2001 so they are php 4 and not the object stuff that is the trend or that which might be in php5. I do not currently use php, so I am not uptodate. Would this be useful?
Back to top
Profile PM WEB 
ypx Offline





Group: Members
Posts: 81
Joined: July 2004
Posted: Oct. 25 2004,06:35 QUOTE

well, it seems to be all that's really needed to begin working with sqlite,
and for the object stuff, it's mostly a matter of code clarity so it's okay as one should always comment his sources.


--------------
French Linux Newbie in learning
Back to top
Profile PM 
ypx Offline





Group: Members
Posts: 81
Joined: July 2004
Posted: Oct. 25 2004,16:26 QUOTE

i've been looking in the official docs concerning the php sqlite extension to find the correspondances between your version and the standard :

 sqlite_query has the same name
 sqlite_fetch_row seems to be named sqlite_fetch_object
 sqlite_fetch_array has the same name
 sqlite_num_rows has the same name
 sqlite_num-cols seems to be named sqlite_num_fields
 sqlite_field_name has the same name
 sqlite_col_names seems to be unrivaled in the standard extension

i've done this to allow a "light" replacement of the standard extension by your version in DSL :)
however, there seems to be a huge use of sqlite_udf_encode and sqlite_udf_decode in the docs, so i assume these might be nearly mandatory to use a nearly standard code.

Hope this will lead to a successful php/sqlite implementation in dsl :)


--------------
French Linux Newbie in learning
Back to top
Profile PM 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Oct. 25 2004,18:20 QUOTE

OK, You have encouraged me to post this. Remember I wrote before there was an official php interface to sqlite. I tried to make it look and work  like the mysql interface at that time.

I have re-posted php.tar.gz in the repository. It includes my simple sqlite interface library.

The following is an ultra simple example:
From /home/dsl create a database and table
$ sqlite db
> create table addressbook(name,address,csz,phone);
> insert into addressbook values("Robert","123 Third","90210","123-555-1234");
> select * from addressbook;
> .exit

Next install php.tar.gz via the mydsl system.
Then start Monkey

Then in /opt/monkey/htdocs make a simple test.php
<?
require "sqlite.php"
$db = "/home/dsl/db";
sqlite_connect($db) or die("Count not connect to database");
$query = "select * from addressbook";
$myResult = sqlite_query($query,$db) or die("Query Failed");
$myRow = sqlite_fetch_array($myResult);
$name = $myRow["name"];
?>
<HTML>
<title>Test Sqlite Interface</title>
<body>
<? print $name; ?>
</body>
</html>

Have Fun. If you improve my library, please let me know.
Back to top
Profile PM WEB 
12 replies since Oct. 21 2004,13:21 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (3) </ 1 [2] 3 >/
reply to topic new topic new poll
Quick Reply: php and sqlite

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code