By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,739 Members | 1,523 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,739 IT Pros & Developers. It's quick & easy.

Can not insert data into SQLite3 database

P: n/a
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,'foo','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
Share this Question
Share on Google+
8 Replies


P: n/a
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,'foo','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_reporting=E_ALL
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 30 '08 #2

P: n/a
On Aug 30, 4:38*pm, Jerry Stuckle <jstuck...@attglobal.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,'foo','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_reporting=E_ALL

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.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

P: n/a
Betikci Boris wrote:
On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attglobal.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,'foo','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_reporting=E_ALL

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.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*******@attglobal.net
==================

Aug 31 '08 #4

P: n/a
On Aug 31, 4:10*am, Jerry Stuckle <jstuck...@attglobal.netwrote:
Betikci Boris wrote:
On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attglobal.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,'foo','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_reporting=E_ALL
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.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...@attglobal.net
==================
In php.ini;

display_error=on
error_reporting=E_ALL & ~E_NOTICE
Aug 31 '08 #5

P: n/a
Betikci Boris wrote:
On Aug 31, 4:10 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Betikci Boris wrote:
>>On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attglobal.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,'foo','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_reporting=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=on
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*******@attglobal.net
==================

Aug 31 '08 #6

P: n/a
On Aug 31, 5:04*pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Betikci Boris wrote:
On Aug 31, 4:10 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
Betikci Boris wrote:
On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attglobal.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,'foo','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']
Sep 1 '08 #7

P: n/a
On Sep 1, 12:08*pm, Betikci Boris <pard...@gmail.comwrote:
On Aug 31, 5:04*pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Betikci Boris wrote:
On Aug 31, 4:10 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Betikci Boris wrote:
>>On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>>>Betikci Boris wrote:
>>>>Can not insert data intoSQLite3database 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,'foo','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_reporting=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=on
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...@attglobal.net
==================

.. and also;

display_error=on
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

P: n/a
Betikci Boris wrote:
On Sep 1, 12:08 pm, Betikci Boris <pard...@gmail.comwrote:
>On Aug 31, 5:04 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>>Betikci Boris wrote:
On Aug 31, 4:10 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
Betikci Boris wrote:
>On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>>Betikci Boris wrote:
>>>Can not insert data intoSQLite3database 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,'foo','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_reporting=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=on
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...@attglobal.net
==================
.. and also;

display_error=on
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;)
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*******@attglobal.net
==================

Sep 3 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.