Support forum

Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_TopicIcon
Inserting linebreak in SQL messageOut
sp_NewPost Add Reply sp_NewTopic Add Topic
January 30, 2016
1:29 pm
Dominik
Guest
Guests

Thanks Henk, worked like a charm! 🙂
I tried "n" and "r" followed by \ but it didnt work, i think it was phpmyadmin fault. While using full query it worked in "SQL" option, but when using "Insert" option, and putting same value, it didnt work.
Thx again

January 30, 2016
9:23 am
Henk Helmantel
Admin
Forum Posts: 554
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

Hello Dominik,

The right method to insert a newline character in a database field depends on the tool or programming language you use to create the database record. For instance, if you use an SQL query in MySQL Workbench you just use line breaks inside the field value:

INSERT INTO MessageOut (MessageTo,MessageText)
VALUES ('+44xxxxxxxxxx','Line 1
Line 2
Line 3);

In MySQL Workbench, you can also use the Form Editor that allows you to directly type new lines in the database fields.

If you use PHP, C# or C++ you can use the newline escape character "\n", e.g.:

$query = "INSERT INTO MessageOut (MessageTo,MessageText) VALUES ('+44xxxxxxxxxx','A\nB\nC')"

Other programming languages may require other methods to insert a newline character in a string.

Regards, Henk

January 29, 2016
8:32 pm
Dominik
Guest
Guests

Hello Henk, i think Henrik wanted to know, how to insert data to SQL/MySQL table, to get following result in recieved message:
"The following orders has an error:
1234
5678
9101"

I tried to insert "A0x0AB0x0AC" into MessageText field of MessageOut table, hoping to recieve folloging sms:
"A
B
C"

but i got just "A0x0AB0x0AC". Tried "
" and "
" but nothing works.
So the question is, what should we insert int MessageText field to get linebreaks.

January 10, 2015
1:24 pm
Henk Helmantel
Admin
Forum Posts: 554
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

Hello Henrik,

The SMS system uses the Line Feed character (decimal 10 or hexadecimal 0x0A) as a new line character. You can insert this character in the place of the comma's in your message to get the line breaks you want.

I am not entirely sure I fully understand your question, can you explain your question in more detail when I did not provide the correct answer?

Regards, Henk

January 10, 2015
11:08 am
Henrik Stisen
Guest
Guests

I'm using SQL connector and would like to use linebreaks.
Example: "The following orders has an error: 1234, 5678, 9101"
should be sent as:
"The following orders has an error:
1234
5678
9101"

I have made a trigger on the messageIn table which sends the text back as an auto reply "SMS server has recived the command: "

When i copy the recived SMS from in to the out table the lineBreaks remains, but i can't see any linebreak code.

Forum Timezone: Europe/Amsterdam

Most Users Ever Online: 494

Currently Online:
3 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Member Stats:

Guest Posters: 365

Members: 0

Moderators: 0

Admins: 1

Forum Stats:

Groups: 2

Forums: 3

Topics: 533

Posts: 1849

Newest Members:

, Henk Helmantel

Administrators: Henk Helmantel: 554