Since my webhost have updated the php on the server from 5.2 to 5.3 I am unable to update any fields in the database if the text contains an apostrophe. I have tried using mysql_real_escape_string() with no success.
I have tried....
$id = uniqid();
$case_account = $_POST['case_account'];
$contact = ucwords($_POST['contact']);
$subject = mysqli_real_escape_string(ucfirst($_POST['name']));
$desc = mysqli_real_escape_string(ucfirst($_POST['description']));
$resolution = mysqli_real_escape_string(ucfirst($_POST['resolution']));
$account_name = $_POST['case_account_name'];
$entered_by = $_POST['entered_by'];
$sql="INSERT INTO cases (id, account_id, name, description, resolution, account_name1, created_by, date_entered) VALUES ('$id', '$case_account','$subject', '$desc', '$resolution', '$account_name', '$entered_by', NOW())";
$result = mysqli_query($sql)or die(mysqli_error());
I have also tried using it in the actual query (I only tried round $subject to test).
$sql="INSERT INTO cases (id, account_id, name, description, resolution, account_name1, created_by, date_entered) VALUES ('$id', '$case_account',".mysqli_real_escape_string."('$subject'), '$desc', '$resolution', '$account_name', '$entered_by', NOW())";
$result = mysql_query($sql)or die(mysql_error());
I've also tried changing the field in the database to text from varChar to text and back again but with no success. I know this should be simple but for some reason I can't make it work.