1

I want to add data to a table cell that contains a line break.

INSERT INTO someTable (data) VALUES ("111\n222");

When I view it in mysql workbench it displays as: "111 222"

Doing it with eloquent writes "111\n222" to the table:

 $someTable = new SomeTable;
 $someTable->data = implode('\n', $dataArray);
 $someTable->save();

I.e. workbench displays "111\n222" instead of the actual new line.

1 Answer 1

4

Change single quote to double quotes:

 $someTable->data = implode("\n", $dataArray);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.