-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Saturday 07 August 2004 11:46, Yves Goergen wrote:
> Hi everyone,

Hi,

> I found the SQLite DLL for PHP today and just wanted to do some
> testing with it. I could rewrite my dump of the MySQL tables and data
> so that SQLite would understand it. But there's a fundamental problem
> left. I have strings that contain ' characters. But strings are
> written in '' characters theirselves. MySQL would want a
> 'Rock\'n\'Roll' here, so ' get backlash-escaped. But there seems to
> be a problem with it. I get no detailled error description, but when
> I remove all \' it works. Here's my SQL and result:
>
> ---SQL
> INSERT INTO tasks VALUES (1, 1, 1091182902, 'Access rules are not
> applied to forums\' categories', 'ACL system:\nRules are only applied
> to the specified and subsidiary forums. Guests may not be able to see
> an actually accessible forum inside a category which they have no
> view rights for.\n-> Extend forum rights to directly superior
> categories in a way that doesn\'t open all other forums', 'ACL
> apply', 5, 1, 1, 1091225287, 4, 1, 2, 0, 0, 0, 1, '1.5-dev-20040729',
> '1.6', 0, 0, ''); ---
>
> ---PHP code
> sqlite_query($db, join(file('bugs.sql')));
> ---
>
> ---PHP output
> Warning: sqlite_query(): unrecognized token: ":" in
> C:\wwwroot\projects\bugtracker\sql.php on line 4
> ---
>
> It means the : behind the \' I guess. Removing all \' helps to
> execute the query.
>
> So how can I insert ' characters into a table other than by \'?

Apply the php-function "sqlite_escape_string" on all the string data you 
insert/update to the database. That should to the trick.

best regards,
Yves

p.s.
There is also "mysql_escape_string"


> PS: Subscription to this list has not replied my anything within an
> hour, I home I'll get replies to this post. Please CC me to be sure.
> TIA

- -- 
Linux 2.4.26 #4 Wed Apr 14 19:23:19 CEST 2004 i686
 12:02:09 up  1:16,  1 user,  load average: 0.47, 0.21, 0.12
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBFKkmfmxiTOp0sQYRAqVyAJwJatsJXMRux5GLycT44Xx2BTen2ACfdC9a
B7tKHzPdIp7MREx68Pstm2w=
=3eqg
-----END PGP SIGNATURE-----

Reply via email to