Re: SQLite problem INSERTing string

From: Date: Sun, 19 Sep 2004 17:18:55 +0000
Subject: Re: SQLite problem INSERTing string
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-36257@lists.php.net to get a copy of this message
$val="127.0.0.1"; $query="INSERT INTO node set uri=\"$val\", name=\"bla\""; Try this one... think is better n less confusing for u... On Sun, 19 Sep 2004 19:13:48 +0200, Darryl <admin@i-roar.com> wrote: > > $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 > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.db (#36257) next »