Welcome Guest, Not a member yet? Register   Sign In
Problem with new line!
#1

[eluser]juan1904[/eluser]
Hi,

I'm trying to insert two different variables into my database like this:
Quote:$text1 = 'blah blah..';
$text2 = 'mhm mhm!';
$text = $text1 . '\n' . $text2;

$this->db->insert('my_table', array('text' => $text));
I want that \n to represent a new line in the text, but when it's still just text. Do you get my problem?
#2

[eluser]tonanbarbarian[/eluser]
this is a fundamental PHP issue.
it has to do with the different between strings using double quotes " and single quotes '
You should go and research this in the PHP docs.
briefly you have to use double quotes " for \n and other such special characters
single quote string ' are not passed in any way and are displayed EXACTLY as entered




Theme © iAndrew 2016 - Forum software by © MyBB