Page 1 of 1

inserting newline into MS Access

Posted: Sun Jun 01, 2003 11:42 pm
by discobean
g'day,

I'm connecting to an access database thru odbc using php..

when inserting into a text(256) field, I can't seem to get a newline character up..

I have tried inserting a string such as this:

Code: Select all

$query = "
  INSERT INTO tablename (fieldname)
  VALUES ('line1\nline2\rline3\n\rline4\r\nline5');
";
and none of these newline combinations work...

I've also tried chr(13) to make sure.

Any ideas?

Marz.[/b]

Posted: Mon Jun 02, 2003 3:16 am
by volka
how did you test that there are no linebreaks?

Posted: Tue Jun 03, 2003 1:08 am
by discobean
all that showed up were sqare text characters in the application that uses the field..

I also opened up the table in access, and I got the same square characters.

I can enter returns in access using CTRL-Enter which works fine...

I ended up just comma delimiting instead of new lines, but if anybody has any ideas let me know.

Posted: Tue Jun 03, 2003 4:03 am
by volka
did you try \r\n ?

Posted: Tue Jun 03, 2003 8:35 am
by hedge
you may want to also try chr(10) + chr(13)

Posted: Tue Jun 03, 2003 8:45 am
by Weird0
How about vbcrlf

Posted: Tue Jun 03, 2003 9:43 am
by discobean
volka, \r\n was listed in my first example between line4 and line5, no dosn't work :(
hedge, chr(10).chr(13) no go either :(
and weird0 I have no idea what vbcrlf means :?

:(

access is the only db i've had problems with, and its the only one I've connected to and used UPDATE/INSERT via ODBC, has anybody had a similar problem with access or odbc?