Re: [PHP] SqLite INSERT want not write
On 19 Apr 2012, at 18:31, Silvio Siefke wrote: i have a script which should write articles in a Sqlite 0database. The script runs without errors, but nothing is written to the database. The Script: http://nopaste.info/09e68c7e37.html The db.php: http://nopaste.info/afd4dee47a.html The Database file has right 777. Has someone an idea? Thank u. The script has syntax errors in it. You won't see those errors because PHP won't run a script with syntax errors, so it won't modify the error_reporting and display_errors settings. You can run php -l script.php to see those errors, but it would be better to set the error_reporting and display_errors values in php.ini on your development system/server. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
Hello, On Thu, 19 Apr 2012 18:39:00 +0100 Stuart Dallas stu...@3ft9.com wrote: The script has syntax errors in it. You won't see those errors because PHP won't run a script with syntax errors, so it won't modify the error_reporting and display_errors settings. You can run php -l script.php to see those errors, but it would be better to set the error_reporting and display_errors values in php.ini on your development system/server. gentoo-desk siefke # php -l test.php * No syntax errors detected in test.php gentoo-desk blog # php -l manage.php No syntax errors detected in manage.php gentoo-desk php # php -l db.php No syntax errors detected in db.php * I have written in this file only the php code. No syntax errors. gentoo-desk blog # php -v PHP 5.3.10-pl0-gentoo with Suhosin-Patch (cli) (built: Apr 5 2012 00:31:12) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies Regards Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
On 19 Apr 2012, at 18:54, Silvio Siefke wrote: On Thu, 19 Apr 2012 18:39:00 +0100 Stuart Dallas stu...@3ft9.com wrote: The script has syntax errors in it. You won't see those errors because PHP won't run a script with syntax errors, so it won't modify the error_reporting and display_errors settings. You can run php -l script.php to see those errors, but it would be better to set the error_reporting and display_errors values in php.ini on your development system/server. gentoo-desk siefke # php -l test.php * No syntax errors detected in test.php gentoo-desk blog # php -l manage.php No syntax errors detected in manage.php gentoo-desk php # php -l db.php No syntax errors detected in db.php * I have written in this file only the php code. No syntax errors. gentoo-desk blog # php -v PHP 5.3.10-pl0-gentoo with Suhosin-Patch (cli) (built: Apr 5 2012 00:31:12) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies I took the code on http://nopaste.info/09e68c7e37.html and put it in test.php. stuart@fred:~$ php -l test.php Parse error: parse error in test.php on line 28 Errors parsing test.php You really can't see the mismatched quotes here? $sql = 'INSERT INTO bloggen (date, autor, title, teaser, content) VALUES ('' . date( 'Y-m-s H:i:s', time() ) . '', :autor, :title, :teaser, :content);'; I'm using PHP 5.3.8 on this particular machine, not that it matters with basic syntax errors like this. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
Maybe this will make the syntax errors stand out more: http://dl.dropbox.com/u/571329/Screenshots/Picture%209.png -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
Hello, On Thu, 19 Apr 2012 13:21:46 -0500 tamouse mailing lists tamouse.li...@gmail.com wrote: Maybe this will make the syntax errors stand out more: http://dl.dropbox.com/u/571329/Screenshots/Picture%209.png ok i have change it to the function date, but now i has the error message: PDOException: SQLSTATE[HY000]: General error: 1 SQL logic error or missing database The database is present, and the tables too. gentoo-desk db # ls silviosiefke.db gentoo-desk db # pwd /var/www/silviosiefke_de/inc/db gentoo-desk ~ # php -l test.php No syntax errors detected in test.php The script now - http://nopaste.info/63fe0a9148.html Regards Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SqLite INSERT want not write
-Original Message- From: Silvio Siefke [mailto:siefke_lis...@web.de] Sent: April 19, 2012 2:53 PM To: php-general@lists.php.net Subject: Re: [PHP] SqLite INSERT want not write Hello, On Thu, 19 Apr 2012 13:21:46 -0500 tamouse mailing lists tamouse.li...@gmail.com wrote: Maybe this will make the syntax errors stand out more: http://dl.dropbox.com/u/571329/Screenshots/Picture%209.png ok i have change it to the function date, but now i has the error message: PDOException: SQLSTATE[HY000]: General error: 1 SQL logic error or missing database The database is present, and the tables too. gentoo-desk db # ls silviosiefke.db gentoo-desk db # pwd /var/www/silviosiefke_de/inc/db gentoo-desk ~ # php -l test.php No syntax errors detected in test.php The script now - http://nopaste.info/63fe0a9148.html Regards Silvio I think all you had to do was change this line: (line 27 in the original paste) $sql = 'INSERT INTO bloggen (date, autor, title, teaser, content) VALUES ('' . date( 'Y-m-s H:i:s', time() ) . '', :autor, :title, :teaser, :content);'; To this: $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES ('' . date( 'Y-m-s H:i:s', time() ) . '', :autor, :title, :teaser, :content);; The issue was (without looking any deeper) the quotes... Try that, and let us know. Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
On 19 Apr 2012, at 19:52, Silvio Siefke wrote: On Thu, 19 Apr 2012 13:21:46 -0500 tamouse mailing lists tamouse.li...@gmail.com wrote: Maybe this will make the syntax errors stand out more: http://dl.dropbox.com/u/571329/Screenshots/Picture%209.png ok i have change it to the function date, but now i has the error message: PDOException: SQLSTATE[HY000]: General error: 1 SQL logic error or missing database gentoo-desk ~ # php -l test.php No syntax errors detected in test.php The script now - http://nopaste.info/63fe0a9148.html Using date() is not valid there. It's possible now() might work (don't use PDO so I dunno for sure), otherwise you'll need to bind that parameter in the same way you're binding the others. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
On 19 Apr 2012, at 19:57, Steven Staples wrote: I think all you had to do was change this line: (line 27 in the original paste) $sql = 'INSERT INTO bloggen (date, autor, title, teaser, content) VALUES ('' . date( 'Y-m-s H:i:s', time() ) . '', :autor, :title, :teaser, :content);'; To this: $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES ('' . date( 'Y-m-s H:i:s', time() ) . '', :autor, :title, :teaser, :content);; The issue was (without looking any deeper) the quotes... Try that, and let us know. Still wrong. It should be as follows. $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (' . date( 'Y-m-s H:i:s', time() ) . ', :autor, :title, :teaser, :content);; Incidentally, the time() in the date call is unnecessary since that's the default value for that parameter. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
On Thu, 19 Apr 2012 14:57:04 -0400 Steven Staples sstap...@mnsi.net wrote: I think all you had to do was change this line: (line 27 in the original paste) $sql = 'INSERT INTO bloggen (date, autor, title, teaser, content) VALUES ('' . date( 'Y-m-s H:i:s', time() ) . '', :autor, :title, :teaser, :content);'; To this: $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES ('' . date( 'Y-m-s H:i:s', time() ) . '', :autor, :title, :teaser, :content);; Thats end with: PDOException: SQLSTATE[HY000]: General error: 1 near (: syntax error I has changed what say Stuart, no Sytax errors but in the database nothing will write. Regards Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SqLite INSERT want not write
-Original Message- From: Silvio Siefke [mailto:siefke_lis...@web.de] Sent: April 19, 2012 3:11 PM To: php-general@lists.php.net Subject: Re: [PHP] SqLite INSERT want not write On Thu, 19 Apr 2012 14:57:04 -0400 Steven Staples sstap...@mnsi.net wrote: I think all you had to do was change this line: (line 27 in the original paste) $sql = 'INSERT INTO bloggen (date, autor, title, teaser, content) VALUES ('' . date( 'Y-m-s H:i:s', time() ) . '', :autor, :title, :teaser, :content);'; To this: $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES ('' . date( 'Y-m-s H:i:s', time() ) . '', :autor, :title, :teaser, :content);; Thats end with: PDOException: SQLSTATE[HY000]: General error: 1 near (: syntax error I has changed what say Stuart, no Sytax errors but in the database nothing will write. Regards Silvio Ok, so I was wrong... ;) it does happen Try this: $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (' . date('Y-m-d H:i:s') . ', :autor, :title, :teaser, :content);; Or $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (NOW(), :autor, :title, :teaser, :content);; The first example, you don't need the time(), and you had the date format wrong... The second example, uses the NOW() time, which is the timestamp for sql Maybe this time I will get it right ;) -- its been a long day, and it is only 1/2 done Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
On Thu, Apr 19, 2012 at 2:17 PM, Steven Staples sstap...@mnsi.net wrote: -Original Message- From: Silvio Siefke [mailto:siefke_lis...@web.de] Sent: April 19, 2012 3:11 PM To: php-general@lists.php.net Subject: Re: [PHP] SqLite INSERT want not write On Thu, 19 Apr 2012 14:57:04 -0400 Steven Staples sstap...@mnsi.net wrote: I think all you had to do was change this line: (line 27 in the original paste) $sql = 'INSERT INTO bloggen (date, autor, title, teaser, content) VALUES ('' . date( 'Y-m-s H:i:s', time() ) . '', :autor, :title, :teaser, :content);'; To this: $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES ('' . date( 'Y-m-s H:i:s', time() ) . '', :autor, :title, :teaser, :content);; Thats end with: PDOException: SQLSTATE[HY000]: General error: 1 near (: syntax error I has changed what say Stuart, no Sytax errors but in the database nothing will write. Regards Silvio Ok, so I was wrong... ;) it does happen Try this: $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (' . date('Y-m-d H:i:s') . ', :autor, :title, :teaser, :content);; Or $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (NOW(), :autor, :title, :teaser, :content);; The first example, you don't need the time(), and you had the date format wrong... The second example, uses the NOW() time, which is the timestamp for sql Maybe this time I will get it right ;) -- its been a long day, and it is only 1/2 done Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php For sqlite, you can specify the current datetime with just now. So perhaps the insert statement could be simplified to: $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES(now, :autor, :title, :teaser, :content);; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
Hello, On Thu, 19 Apr 2012 15:17:06 -0400 Steven Staples sstap...@mnsi.net wrote: Ok, so I was wrong... ;) it does happen Try this: $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (' . date('Y-m-d H:i:s') . ', :autor, :title, :teaser, :content);; No errors, but no entry in the database. Or $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (NOW(), :autor, :title, :teaser, :content);; PDOException: SQLSTATE[HY000]: General error: 1 no such function: NOW Now is not availible in Sqlite, can use date, Which rights must have the database? siefke@gentoo-desk db $ ls -l insgesamt 4 -rw-rw-rw- 1 siefke siefke 4096 19. Apr 21:25 silviosiefke.db Regards Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
On 19 Apr 2012, at 20:40, siefke_lis...@web.de wrote: On Thu, 19 Apr 2012 15:17:06 -0400 Steven Staples sstap...@mnsi.net wrote: Ok, so I was wrong... ;) it does happen Try this: $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (' . date('Y-m-d H:i:s') . ', :autor, :title, :teaser, :content);; No errors, but no entry in the database. Or $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (NOW(), :autor, :title, :teaser, :content);; PDOException: SQLSTATE[HY000]: General error: 1 no such function: NOW Now is not availible in Sqlite, can use date, Which rights must have the database? siefke@gentoo-desk db $ ls -l insgesamt 4 -rw-rw-rw- 1 siefke siefke 4096 19. Apr 21:25 silviosiefke.db What does the script output? The only path through your script that doesn't display something is if there are missing $_POST elements, and the PDO errors you've shown previously suggest that they're all present and correct. So if the thing is running correctly, regardless of what's going into the DB, you should be getting some sort of output. Are you? -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SqLite INSERT want not write
-Original Message- From: siefke_lis...@web.de [mailto:siefke_lis...@web.de] Sent: April 19, 2012 3:40 PM To: php-general@lists.php.net Subject: Re: [PHP] SqLite INSERT want not write Hello, On Thu, 19 Apr 2012 15:17:06 -0400 Steven Staples sstap...@mnsi.net wrote: Ok, so I was wrong... ;) it does happen Try this: $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (' . date('Y-m-d H:i:s') . ', :autor, :title, :teaser, :content);; No errors, but no entry in the database. Or $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (NOW(), :autor, :title, :teaser, :content);; PDOException: SQLSTATE[HY000]: General error: 1 no such function: NOW Now is not availible in Sqlite, can use date, Which rights must have the database? siefke@gentoo-desk db $ ls -l insgesamt 4 -rw-rw-rw- 1 siefke siefke 4096 19. Apr 21:25 silviosiefke.db Regards Silvio Ok, shot in the dark here are you closing your connection to the sqlite db? From what I see, you're not... when I was writing an app in Python, I remember having this issue, and because I didn't close the connection, it didn't commit the writes to the database... just a thought... Steve. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
Hello, On Thu, 19 Apr 2012 20:43:52 +0100 Stuart Dallas stu...@3ft9.com wrote: On 19 Apr 2012, at 20:40, siefke_lis...@web.de wrote: On Thu, 19 Apr 2012 15:17:06 -0400 Steven Staples sstap...@mnsi.net wrote: What does the script output? The only path through your script that doesn't display something is if there are missing $_POST elements, and the PDO errors you've shown previously suggest that they're all present and correct. So if the thing is running correctly, regardless of what's going into the DB, you should be getting some sort of output. Are you? Ah im so shamed now. I have only look at the size not in the database. I has make now a SELECT and all is well done. Im sorry, i should stopped try to programming with php. All is good, thank u so much. All wish nice rest of day or a nice day where ever you are. Regards Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
On Thu, Apr 19, 2012 at 12:40 PM, siefke_lis...@web.de siefke_lis...@web.de wrote: Hello, On Thu, 19 Apr 2012 15:17:06 -0400 Steven Staples sstap...@mnsi.net wrote: Ok, so I was wrong... ;) it does happen Try this: $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (' . date('Y-m-d H:i:s') . ', :autor, :title, :teaser, :content);; No errors, but no entry in the database. Or $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (NOW(), :autor, :title, :teaser, :content);; PDOException: SQLSTATE[HY000]: General error: 1 no such function: NOW Now is not availible in Sqlite, can use date, Technically, it's date('now') per [1] :) RTFM FTW! http://www.sqlite.org/draft/lang_datefunc.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
On Thu, 19 Apr 2012 13:00:40 -0700 Tommy Pham tommy...@gmail.com wrote: Technically, it's date('now') per [1] :) RTFM FTW! Yes its right, i have read it on sqlite.org. PS: Excuse me, what mean RTFM FTW? Regards Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
Bastien Koert On 2012-04-19, at 4:11 PM, Silvio Siefke siefke_lis...@web.de wrote: On Thu, 19 Apr 2012 13:00:40 -0700 Tommy Pham tommy...@gmail.com wrote: Technically, it's date('now') per [1] :) RTFM FTW! Yes its right, i have read it on sqlite.org. PS: Excuse me, what mean RTFM FTW? Read The Fine Manual For The Win Regards Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php