I have been developing a cms site for a client, which uses the adodb package to update the database. I have been doing this as below;
$updateSQL = sprintf("UPDATE tblSections SET Content = '%s' , ContentTitle = '%s' ,UpdatedDate = '%s' WHERE SectionID = %s", $Content, $ContentTitle, date('Y-m-d H:i:s',time()), $SectionID ); $Resultl = False; $Result1 = $connDB->Execute($updateSQL) or die($connDB->ErrorMsg()); $Result1 = True; /*Some validation stuff*/
When I set this up on the test server, and have used the same syntax on other sites, this works fine. However, when I have put this on the client server, I get syntax errors anywhere there is an apostraphie in the page content.
Persumably this is breaking the string, but it seams odd it has worked everywhere else, and as I am using a wysiwyg editor, I can't really stop people putting apostrophies in the content.
I tried a string replace to convert them to ascii codes, but this just broke other elements with double quotes:(
Any ideas as to how this might be resolved are greatly appreciated.