Skip to Content.
Sympa Menu

freetds - Re: [freetds] PHP: Inserts with Unicode

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Daniel Fazekas <fdsubs AT axelero.hu>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] PHP: Inserts with Unicode
  • Date: Wed, 21 Jan 2004 20:23:26 +0100


On Jan 21, 2004, at 9:25, Marco Brinkmann wrote:

I can read and display all NTEXT and NVARCHAR-Fields from MSSQL correctly.
But if I try to write the read data into the database I get always the parse
error "Unclosed quotation mark...".
The Insert looks like...

db("INSERT INTO table (test) (N'".addslashes($read)."')");

1. It's asking for serious trouble if you really are using the keyword "table" as the name of your table. If you insist, you'll have to enclose it in square brackets:

INSERT INTO [table] (test) VALUES ('xxxx');

2. What's addslashes() supposed to do? MSSQL does not use slashes to escape quotation marks, it's the same as in Sybase, you just have to double any single quotation marks. For example: str_replace("'", "''", $str);

3. Your query seems to be missing the keyword "VALUES". It's no wonder if it doesn't work that way. :)

4. Try removing that N character. It should work both with and without it.

--
fds





Archive powered by MHonArc 2.6.24.

Top of Page