try to insert data...

This is a discussion on try to insert data... within the PHP Language forums, part of the PHP Programming Forums category; hi, i try to insert data in a database Code: $mem_nomembre = $_SESSION["mem_nomembre"]; $sec_nosection = $_POST['sec_nosection']; $str = $_POST[&...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-14-2005
os2
 
Posts: n/a
Default try to insert data...

hi,

i try to insert data in a database




Code:
$mem_nomembre = $_SESSION["mem_nomembre"];
$sec_nosection = $_POST['sec_nosection'];
$str = $_POST["message"];
$str = preg_replace_callback('`\[(code|url|img)\](.+?)\[/\1\]`si',
'bbcode', $str);
$str = mysql_real_escape_string($str);

mysql_query("insert into message (sec_nosection, mem_nomembre,
mes_titre, mes_message) values ('".$_POST['sec_nosection']."',
'".$mem_nomembre."', '".$_POST["titre"]."', '".$str."')");

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

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:55 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0