Bluehost.com Web Hosting $6.95

sqlite

This is a discussion on sqlite within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Problem description: I have php version 5.1.6, but I am having troubles in running sqlite. For example, when ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-23-2006
Siegfreed
 
Posts: n/a
Default sqlite

Problem description:

I have php version 5.1.6, but I am having troubles in running sqlite.

For example, when i run the following code:

<?php
// create new database (procedural interface)
$db = sqlite_open("db.sqlite");

// uncomment next line if you still need to create table foo
// sqlite_query($db , "CREATE TABLE foo (id INTEGER PRIMARY KEY, name
CHAR(255))");

// insert sample data
sqlite_query($db, "INSERT INTO foo (name) VALUES ('Ilia')");
sqlite_query($db, "INSERT INTO foo (name) VALUES ('Ilia2')");
sqlite_query($db, "INSERT INTO foo (name) VALUES ('Ilia3')");

// execute query
$result = sqlite_query($db, "SELECT * FROM foo");
// iterate through the retrieved rows
while ($row = sqlite_fetch_array($result)) {
print_r($row);
/* each result looks something like this
Array
(
[0] => 1
[id] => 1
[1] => Ilia
[name] => Ilia
)
*/
}

// close database connection
sqlite_close($db);

?>

I get the following message:

Fatal error: Call to undefined function sqlite_open() in
C:\http-dir\new_db_02.htm on line 15

What the problem(s) is, or are?
Reply With Quote
  #2 (permalink)  
Old 12-23-2006
Ric
 
Posts: n/a
Default Re: sqlite

Siegfreed schrieb:
> Problem description:
>
> I have php version 5.1.6, but I am having troubles in running sqlite.
>
> For example, when i run the following code:
>
> <?php
> // create new database (procedural interface)
> $db = sqlite_open("db.sqlite");
>
> // uncomment next line if you still need to create table foo
> // sqlite_query($db , "CREATE TABLE foo (id INTEGER PRIMARY KEY, name
> CHAR(255))");
>
> // insert sample data
> sqlite_query($db, "INSERT INTO foo (name) VALUES ('Ilia')");
> sqlite_query($db, "INSERT INTO foo (name) VALUES ('Ilia2')");
> sqlite_query($db, "INSERT INTO foo (name) VALUES ('Ilia3')");
>
> // execute query
> $result = sqlite_query($db, "SELECT * FROM foo");
> // iterate through the retrieved rows
> while ($row = sqlite_fetch_array($result)) {
> print_r($row);
> /* each result looks something like this
> Array
> (
> [0] => 1
> [id] => 1
> [1] => Ilia
> [name] => Ilia
> )
> */
> }
>
> // close database connection
> sqlite_close($db);
>
> ?>
>
> I get the following message:
>
> Fatal error: Call to undefined function sqlite_open() in
> C:\http-dir\new_db_02.htm on line 15


Check your installation php doesn't know about sqlite_open
Is your php version compiled with sqlite support?
Or is the sqlite extension installed and correctly set in your php.ini?
>
> What the problem(s) is, or are?

Reply With Quote
  #3 (permalink)  
Old 12-23-2006
Siegfreed
 
Posts: n/a
Default Re: sqlite

Ric wrote:

My php version is 5.1.6, consequently is allegedly compiled with sqlite.

The extensions:

extension=php_pdo.dll
extension=php_pdo_sqlite.dll
extension=php_sqlite.dll

are located in the directory:

c:\program files\php\ext

php.ini is located in:

c:\windows

In ther php.ini file the following lines are present and not commented out :

extension_dir = C:\program files\php\ext

extension=php_pdo.dll
extension=php_pdo_sqlite.dll
extension=php_sqlite.dll




Reply With Quote
  #4 (permalink)  
Old 12-25-2006
Laurent Seiler
 
Posts: n/a
Default Re: sqlite

there are many functions in sqlite with two different methods you can write
them. i recomend you to check if there's another method to write that.

--

my homepage: www.m2k.dl.am
Reply With Quote
  #5 (permalink)  
Old 12-25-2006
Ric
 
Posts: n/a
Default Re: sqlite

Siegfreed schrieb:
> Ric wrote:
>
> My php version is 5.1.6, consequently is allegedly compiled with sqlite.


What does command:


php -m

tell you?


>
> The extensions:
>
> extension=php_pdo.dll
> extension=php_pdo_sqlite.dll
> extension=php_sqlite.dll
>
> are located in the directory:



Are those extensions for php 5.1.6 or at least 5.x?
>
> c:\program files\php\ext
>
> php.ini is located in:
>
> c:\windows
>
> In ther php.ini file the following lines are present and not commented
> out :
>
> extension_dir = C:\program files\php\ext
>
> extension=php_pdo.dll
> extension=php_pdo_sqlite.dll
> extension=php_sqlite.dll
>
>
>
>

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:34 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0