RE: [PHP-DB] SQLite problem INSERTing string
| From: | Darryl | Date: | Sun, 19 Sep 2004 17:13:48 +0000 |
| Subject: | RE: [PHP-DB] SQLite problem INSERTing string | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-36256@lists.php.net to get a copy of this message | ||
$val = "127.0.0.1";
$query = "INSERT INTO node (uri,name) VALUES
('".$val."','bla')";
Try that?
-----Original Message-----
From: Stefan Reimers [mailto:php@stefan-reimers.de]
Sent: Sunday, September 19, 2004 6:37 PM
To: php-db@lists.php.net
Subject: [PHP-DB] SQLite problem INSERTing string
Hello,
I am currently experiencing a problem with an INSERT statement in SQLite.
First of all an excerpt from the code:
$val = "127.0.0.1";
$query = "INSERT INTO node (uri,name) VALUES (".$val.",'bla')";
$db_name = "mysqlite";
if($db_hdl = sqlite_open($db_name)){
$db_result = sqlite_query($db_hdl,$query);
}
I get the error message:
Warning: sqlite_query(): near ".": syntax error in
C:\Programme\xampp\htdocs\dipl\testclient\sqlite_test.php on line 10
I tried addslashes (which I know I shouldn't), sqlite_escape_string, any
variant of quotes etc, I asked google and the searched the news groups
but with no relevant result, except the insight, that others experience
the same so long unsolved problem or use a syntax in their tutorials
that does not work with my code...
As you an see from the error message, I use Windows, Apache, PHP4 with
SQLite in a 2.8.14 version.
If anyone has a clue, please contact me or just answer.
Thanks in advance
Stefan
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php