Following code truncates every string that has a single quote in it. I tried with and without stripslashes, tried stripslashes_deep but none of them works. If for example name is “Mac Donald’s” its saved as “Mac Donald” and simply cut off where the single quote is.
foreach ($_POST as $key => $value)
{
$$key = stripslashes($value);
echo $key."--".$$key."<br>";
}
$wpdb->update("x_data",array('name'=>$d_name,'address'=>$address,'city'=>$city,'state'=>$state,'postalcode'=>$postalcode,'phone'=>$phone,'fax'=>$fax,'email'=>$email),array('uid' => $user_ID,'id'=>$gid));
Any help appreciated
Try str_replace like this: