2

So i have a Simple Question , i am trying to get the Text from an Html Form , then add a '\n' on each Request , for Line Break , i have tried this :

 '".$customtext."'.'\n'

Or this :

 '".$customtext.'\n'"'

with no luck , is there a way to do it ?

Thanks you .

323go
  • 14,143
  • 6
  • 33
  • 41
Nikita
  • 189
  • 1
  • 4
  • 16

2 Answers2

1

You need to use double quotes (For example: $var_to_print = $str . "\n";) // will not work using simple quote '

I'm not sure if u are looking for this, or may you want to use a while/foreach bucle to replace each "\n" to "< br>"

hope it helps!

Juanillo
  • 11
  • 1
  • Thanks you , as Matthias Said , its work , but i am looking to Append the Text to the DataBase – Nikita Feb 27 '13 at 17:32
0

Try $customtext."\n" -- double quotes should fix the problem. Edit: and if you want to output within HTML code you can take a look at the function nl2br.

Matthias W.
  • 1,039
  • 1
  • 11
  • 23
  • does not work :/ , no i dont want within HTML , i want to store as it is in the DataBase – Nikita Feb 27 '13 at 17:25
  • What exactly does not work? Can you give us some code + output data? – Matthias W. Feb 27 '13 at 17:25
  • $sq6="UPDATE $name SET customtext='".$customtext."'."\n" WHERE idname='".$customtext1."'"; this Code provide me a Script Error – Nikita Feb 27 '13 at 17:27
  • `$sq6="UPDATE $name SET customtext='".$customtext."\n"' WHERE idname='".$customtext1."'";` -- I guess you want the newline within the customertext? – Matthias W. Feb 27 '13 at 17:28
  • Yes . i am Sorry about the Title , my Real Question is : How to Append some Text to the MySQL DataBase with a Line Break – Nikita Feb 27 '13 at 17:30
  • Then take a look here: http://stackoverflow.com/questions/4128335/sql-update-all-values-in-a-field-with-appended-string-concat-not-working -- or directly look for "concat" in mySQL. Otherwise you could first have a SELECT and then an UPDATE query. – Matthias W. Feb 27 '13 at 22:08