By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,401 Members | 1,702 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,401 IT Pros & Developers. It's quick & easy.

try to insert data...

P: n/a
os2
hi,

i try to insert data in a database


Expand|Select|Wrap|Line Numbers
  1. $mem_nomembre = $_SESSION["mem_nomembre"];
  2. $sec_nosection = $_POST['sec_nosection'];
  3. $str = $_POST["message"];
  4. $str = preg_replace_callback('`\[(code|url|img)\](.+?)\[/\1\]`si',
  5. 'bbcode', $str);
  6. $str = mysql_real_escape_string($str);
  7.  
  8. mysql_query("insert into message (sec_nosection, mem_nomembre,
  9. mes_titre, mes_message) values ('".$_POST['sec_nosection']."',
  10. '".$mem_nomembre."', '".$_POST["titre"]."', '".$str."')");
  11.  
  12.  

if i try to insert: j'ai l'impression en parcourant le web

when i display the message i get: j\'ai l\'impression en parcourant le
web

if i put: stripslashes after mysql_real_escape_string, there are some:
rn in the sentence...

how to correct that?

when i insert a message, if i write

today is hot.
i like swimming.
i would like to get the same result...

now that display me:

today is hot. i like swimming.

if i do:

$str = preg_replace_callback('`\[(code|url|img)\](.+?)\[/\1\]`si',
'bbcode', $str);
$str = nl2br($str);
$str = mysql_real_escape_string($str);

i get:

today is hot.

i like swimming.

how to get this result?

thanks

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.