473,788 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can not insert data into SQLite3 database

Can not insert data into SQLite3 database through browser however i
can easily insert data into my db from konsole, in both attmpts i used
php 5.2.6 on 2.6.25.* linux kernel

i think there is a problem with my php setup but i could not find
it...

here is the code;
----------------------------------------------------------------------------------------
$db = new PDO("sqlite:bar .db");
$sql = "select * from user";

$query = "insert into user values(null,'fo o','bar')";
$db->query($query );
print_r($db->query($query)) ;
print_r($db->query($sql)) ;

foreach ($db->query($sql) as $row)
print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
"<br>";

unset($db);
------------------------------------------------------------------------------------------

first print_r() function prints nothing, actually "select" works,
"insert" wouldn't....

What's the problem?
Aug 30 '08 #1
8 6619
Betikci Boris wrote:
Can not insert data into SQLite3 database through browser however i
can easily insert data into my db from konsole, in both attmpts i used
php 5.2.6 on 2.6.25.* linux kernel

i think there is a problem with my php setup but i could not find
it...

here is the code;
----------------------------------------------------------------------------------------
$db = new PDO("sqlite:bar .db");
$sql = "select * from user";

$query = "insert into user values(null,'fo o','bar')";
$db->query($query );
print_r($db->query($query)) ;
print_r($db->query($sql)) ;

foreach ($db->query($sql) as $row)
print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
"<br>";

unset($db);
------------------------------------------------------------------------------------------

first print_r() function prints nothing, actually "select" works,
"insert" wouldn't....

What's the problem?
Enable all errors and display them - in your php.ini file, ensure you have:

display_error=o n
error_reporting =E_ALL
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Aug 30 '08 #2
On Aug 30, 4:38*pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Betikci Boris wrote:
Can not insert data into SQLite3 database through browser however i
can easily insert data into my db from konsole, in both attmpts i used
php 5.2.6 on 2.6.25.* linux kernel
i think there is a problem with my php setup but i could not find
it...
here is the code;
----------------------------------------------------------------------------------------
$db = new PDO("sqlite:bar .db");
$sql = "select * from user";
$query = "insert into user values(null,'fo o','bar')";
$db->query($query );
print_r($db->query($query)) ;
print_r($db->query($sql)) ;
*foreach ($db->query($sql) as $row)
* * print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
"<br>";
unset($db);
------------------------------------------------------------------------------------------
first print_r() function prints nothing, actually "select" works,
"insert" wouldn't....
What's the problem?

Enable all errors and display them - in your php.ini file, ensure you have:

display_error=o n
error_reporting =E_ALL

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
i've tried with try catch but that's the point there is nothing to
report.. According to this function =print_r($db->query($query)) ;
query returns 0 or even -1,

I think the problem with mod_php configuration on cli with php
everything works fine ...
Aug 30 '08 #3
Betikci Boris wrote:
On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>Betikci Boris wrote:
>>Can not insert data into SQLite3 database through browser however i
can easily insert data into my db from konsole, in both attmpts i used
php 5.2.6 on 2.6.25.* linux kernel
i think there is a problem with my php setup but i could not find
it...
here is the code;
----------------------------------------------------------------------------------------
$db = new PDO("sqlite:bar .db");
$sql = "select * from user";
$query = "insert into user values(null,'fo o','bar')";
$db->query($query );
print_r($db->query($query)) ;
print_r($db->query($sql)) ;
foreach ($db->query($sql) as $row)
print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
"<br>";
unset($db);
------------------------------------------------------------------------------------------
first print_r() function prints nothing, actually "select" works,
"insert" wouldn't....
What's the problem?
Enable all errors and display them - in your php.ini file, ensure you have:

display_error= on
error_reportin g=E_ALL

--
============== ====
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attg lobal.net
============== ====

i've tried with try catch but that's the point there is nothing to
report.. According to this function =print_r($db->query($query)) ;
query returns 0 or even -1,

I think the problem with mod_php configuration on cli with php
everything works fine ...
I didn't say use try and catch. Please try what I wrote.

PHP base code doesn't generally throw exceptions. But it does provide
error information if you have it configured to do so.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Aug 31 '08 #4
On Aug 31, 4:10*am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Betikci Boris wrote:
On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Betikci Boris wrote:
Can not insert data into SQLite3 database through browser however i
can easily insert data into my db from konsole, in both attmpts i used
php 5.2.6 on 2.6.25.* linux kernel
i think there is a problem with my php setup but i could not find
it...
here is the code;
----------------------------------------------------------------------------------------
$db = new PDO("sqlite:bar .db");
$sql = "select * from user";
$query = "insert into user values(null,'fo o','bar')";
$db->query($query );
print_r($db->query($query)) ;
print_r($db->query($sql)) ;
*foreach ($db->query($sql) as $row)
* * print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
"<br>";
unset($db);
------------------------------------------------------------------------------------------
first print_r() function prints nothing, actually "select" works,
"insert" wouldn't....
What's the problem?
Enable all errors and display them - in your php.ini file, ensure you have:
display_error=o n
error_reporting =E_ALL
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
i've tried with try catch but that's the point there is nothing *to
report.. *According to this function =print_r($db->query($query)) ;
query returns 0 or even -1,
I think the problem with mod_php configuration on cli with php
everything works fine ...

I didn't say use try and catch. *Please try what I wrote.

PHP base code doesn't generally throw exceptions. *But it does provide
error information if you have it configured to do so.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
In php.ini;

display_error=o n
error_reporting =E_ALL & ~E_NOTICE
Aug 31 '08 #5
Betikci Boris wrote:
On Aug 31, 4:10 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>Betikci Boris wrote:
>>On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Betikci Boris wrote:
Can not insert data into SQLite3 database through browser however i
can easily insert data into my db from konsole, in both attmpts i used
php 5.2.6 on 2.6.25.* linux kernel
i think there is a problem with my php setup but i could not find
it...
here is the code;
----------------------------------------------------------------------------------------
$db = new PDO("sqlite:bar .db");
$sql = "select * from user";
$query = "insert into user values(null,'fo o','bar')";
$db->query($query );
print_r($ db->query($query)) ;
print_r($ db->query($sql)) ;
foreach ($db->query($sql) as $row)
print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
"<br>";
unset($db );
------------------------------------------------------------------------------------------
first print_r() function prints nothing, actually "select" works,
"insert" wouldn't....
What's the problem?
Enable all errors and display them - in your php.ini file, ensure you have:
display_erro r=on
error_report ing=E_ALL
i've tried with try catch but that's the point there is nothing to
report.. According to this function =print_r($db->query($query)) ;
query returns 0 or even -1,
I think the problem with mod_php configuration on cli with php
everything works fine ...
I didn't say use try and catch. Please try what I wrote.

PHP base code doesn't generally throw exceptions. But it does provide
error information if you have it configured to do so.

In php.ini;

display_error=o n
error_reporting =E_ALL & ~E_NOTICE
That still isn't what I asked you to put in your php.ini file!

Do you always have this much trouble following a simple request?

Sorry, I'm not in the habit of wasting my time. Find someone else to
help you.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Aug 31 '08 #6
On Aug 31, 5:04*pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Betikci Boris wrote:
On Aug 31, 4:10 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Betikci Boris wrote:
On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Betikci Boris wrote:
Can not insert data into SQLite3 database through browser however i
can easily insert data into my db from konsole, in both attmpts i used
php 5.2.6 on 2.6.25.* linux kernel
i think there is a problem with my php setup but i could not find
it...
here is the code;
----------------------------------------------------------------------------------------
$db = new PDO("sqlite:bar .db");
$sql = "select * from user";
$query = "insert into user values(null,'fo o','bar')";
$db->query($query );
print_r($d b->query($query)) ;
print_r($d b->query($sql)) ;
*foreach ($db->query($sql) as $row)
* * print $row['id'] . " " . $row['text'] . " " . $row['text2']
Sep 1 '08 #7
On Sep 1, 12:08*pm, Betikci Boris <pard...@gmail. comwrote:
On Aug 31, 5:04*pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Betikci Boris wrote:
On Aug 31, 4:10 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>Betikci Boris wrote:
>>On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>>>Betikci Boris wrote:
>>>>Can not insert data intoSQLite3data base through browser however i
>>>>can easily insert data into my db from konsole, in both attmpts iused
>>>>php 5.2.6 on 2.6.25.* linux kernel
>>>>i think there is a problem with my php setup but i could not find
>>>>it...
>>>>here is the code;
>>>>----------------------------------------------------------------------------------------
>>>>$db = new PDO("sqlite:bar .db");
>>>>$sql = "select * from user";
>>>>$query = "insert into user values(null,'fo o','bar')";
>>>>$db->query($query );
>>>>print_r($ db->query($query)) ;
>>>>print_r($ db->query($sql)) ;
>>>>*foreach ($db->query($sql) as $row)
>>>>* * print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
>>>>"<br>";
>>>>unset($db );
>>>>------------------------------------------------------------------------------------------
>>>>first print_r() function prints nothing, actually "select" works,
>>>>"insert" wouldn't....
>>>>What's the problem?
>>>Enable all errors and display them - in your php.ini file, ensure you have:
>>>display_erro r=on
>>>error_report ing=E_ALL
>>i've tried with try catch but that's the point there is nothing *to
>>report.. *According to this function =print_r($db->query($query)) ;
>>query returns 0 or even -1,
>>I think the problem with mod_php configuration on cli with php
>>everything works fine ...
>I didn't say use try and catch. *Please try what I wrote.
>PHP base code doesn't generally throw exceptions. *But it does provide
>error information if you have it configured to do so.
In php.ini;
display_error=o n
error_reporting =E_ALL & ~E_NOTICE
That still isn't what I asked you to put in your php.ini file!
Do you always have this much trouble following a simple request?
Sorry, I'm not in the habit of wasting my time. *Find someone else to
help you.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===

.. and also;

display_error=o n
error_reporting =E_ALL

prints nothing.. *what a strange mod_php malfunction..
Oh! what a shame!
Directory permissions, which is the database located, must allow to
write!...
chmod 777 todir has been removed all problems;)
Sep 3 '08 #8
Betikci Boris wrote:
On Sep 1, 12:08 pm, Betikci Boris <pard...@gmail. comwrote:
>On Aug 31, 5:04 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>>Betikci Boris wrote:
On Aug 31, 4:10 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Betikci Boris wrote:
>On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>>Betikci Boris wrote:
>>>Can not insert data intoSQLite3data base through browser however i
>>>can easily insert data into my db from konsole, in both attmpts i used
>>>php 5.2.6 on 2.6.25.* linux kernel
>>>i think there is a problem with my php setup but i could not find
>>>it...
>>>here is the code;
>>>----------------------------------------------------------------------------------------
>>>$db = new PDO("sqlite:bar .db");
>>>$sql = "select * from user";
>>>$query = "insert into user values(null,'fo o','bar')";
>>>$db->query($query );
>>>print_r( $db->query($query)) ;
>>>print_r( $db->query($sql)) ;
>>> foreach ($db->query($sql) as $row)
>>> print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
>>>"<br>" ;
>>>unset($d b);
>>>------------------------------------------------------------------------------------------
>>>first print_r() function prints nothing, actually "select" works,
>>>"inser t" wouldn't....
>>>What's the problem?
>>Enable all errors and display them - in your php.ini file, ensure you have:
>>display_e rror=on
>>error_rep orting=E_ALL
>i've tried with try catch but that's the point there is nothing to
>report.. According to this function =print_r($db->query($query)) ;
>query returns 0 or even -1,
>I think the problem with mod_php configuration on cli with php
>everythi ng works fine ...
I didn't say use try and catch. Please try what I wrote.
PHP base code doesn't generally throw exceptions. But it does provide
error information if you have it configured to do so.
In php.ini;
display_erro r=on
error_report ing=E_ALL & ~E_NOTICE
That still isn't what I asked you to put in your php.ini file!
Do you always have this much trouble following a simple request?
Sorry, I'm not in the habit of wasting my time. Find someone else to
help you.
--
============= =====
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@att global.net
============= =====
.. and also;

display_error= on
error_reportin g=E_ALL

prints nothing.. what a strange mod_php malfunction..

Oh! what a shame!
Directory permissions, which is the database located, must allow to
write!...
chmod 777 todir has been removed all problems;)
Which, would have been indicated by an E_NOTICE message if you would
have followed my initial instructions. You probably changed the wrong
php.ini file.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Sep 3 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2196
by: lolmcbride | last post by:
Hi, is it possible to pass args through the api which are the same as the args you can use on the sqlite3 command line? What I'm talking about is the .mode or .output commands which you can enter via the sqlite3 cli so I can dynamically change were the output goes. Ta
2
4951
by: Josh | last post by:
Hi, I'm running into a problem when trying to create a view in my sqlite database in python. I think its a bug in the sqlite3 api that comes with python 2.5. This works as expected: conn = sqlite3.connect(':memory:') conn.execute("create table foo (a int,b int)") conn.execute('create view bar as select * from foo')
1
2654
by: Nader Emami | last post by:
L.S., I have to compile (install) locally Python 2.5, because I don't have 'root' permission. Besides I would use 'sqlite3' as a database for TurboGears/Django. I have installed 'sqlite3' somewhere on my Linux (/path/to/sqlite'). What do I have to do if I want to compile 'Python' with 'sqlite3'? I would appreciate if somebody tells me to solve this problem. With regards,
4
8925
by: Simon | last post by:
I installed the source code on unix for python 2.5.1. The install went mainly okay, except for some failures regarding: _ssl, _hashlib, _curses, _curses_panel. No errors regarding sqlite3. However, when I start python and do an import sqlite3 I get: /ptmp/bin/python Python 2.5.1 (r251:54863, May 29 2007, 05:19:30) on sunos5
2
2277
by: =?ISO-8859-1?Q?S=E9bastien_Ramage?= | last post by:
Hi ! I'm trying to build an client/server app based on Pyro and sqlite3. But I have a problem using sqlite3 on the server I got this error : sqlite3.ProgrammingError: ('SQLite objects created in a thread can only be used in that same thread.The object was created in thread id 240 and this
12
17269
by: John | last post by:
Hi, I'm trying to connect to a SQLite3 database for days now but I'm stuck. PHP returns an error that I made a "call to undefined function sqlite_open(). In the php.ini the extension=php_pdo.dll and extension=php_sqlite.dll are set. What am I doing wrong??? Thank you in advance, John
1
3105
by: jeff_d_harper | last post by:
I've run into a problem with text encoding in the Sqlite3 module. I think it may be a bug. By default sqlite3 converts strings in the database from UTF-8 to unicode. This conversion can be controlled by changing the connection's text_factory. I have a database that stores strings in 8-bit ISO-8859. So, I set the text_factory to do no conversion. In my database I use user defined functions. I noticed that even when I set...
15
14789
by: Kurda Yon | last post by:
Hi, I try to "build" and "install" pysqlite? After I type "python setup.py build" I get a lot of error messages? The first error is "src/ connection.h:33:21: error: sqlite3.h: No such file or directory". So, I assume that the absence of the "sqlite3.h" is the origin of the problem. I found on the web, that this file should be either in "/usr/local/ include" or in "/usr/local/lib". I check this directories and I really
0
1204
by: klia | last post by:
hello everyone How can i be able to prompt users to query their search about photos Date in which date formate is "2008:12:10". by the way the following codes are hardcoded. import os import sqlite3 from pysqlite2 import dbapi2 as sqlite3 #import Database.py #Retrieving Data from DB
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4070
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.