Rahul Dev Posted February 25, 2011 Share Posted February 25, 2011 Hello guys i have a problem while inserting a string to db. The string is cut out and only part of it is inserted and the string is not trimmed my code: <?php require ('dbconnect.php'); $text = "Maltraitance : Shirin Aumeeruddy-Cziffra réclame la fermeture de la crèche «Le Nid» de Sodnac "; $newString = preg_replace('/^[a-zàâçéèêëîïôûùüÿ]*$/i', ' ', $text); $newString2 = trim($newString); echo $newString2; $sql = "INSERT INTO test VALUES('".$newString2."')"; $result = mysql_query($sql); ?> The part that is inserted is: Maltraitance Shirin Aumeeruddy Cziffra r As you can see there's an additional space and the string is not complete Any1 can help?? Quote Link to comment Share on other sites More sharing options...
sasa Posted February 26, 2011 Share Posted February 26, 2011 1st what is type of your db field 2nd what do you try to do with your preg_replace Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.