Update query failing because of ' apostrophes.
Posted: Thu Sep 25, 2008 3:30 am
Hi folks,
I'm doing a simple update with the below code:
This is what is written into the database. My Php is getting confused with ' (apostrophes), in the ProjectStory field below.
How do I over come this? Any ideas folks?
thanks guys
I'm doing a simple update with the below code:
Code: Select all
$queryUpdate = "UPDATE tbl_projects SET ProjectTitle='$pjTitle', ProjectCostUSD='$pjCostUSD', ProjectRegionID='$pjRegionID', ProjectCountry='$pjCountryID', ProjectCatID='$pjCategoryID', ProjectBeneficiaryID='$pjBeneficiaryID', ProjectStory='$pjStory', ProjectProjectURL='$pjURL', ProjectLIVE='0', ProjectEdit='1', ProjectDelete='0', ProjectLastUpdatedDate='$currentDate' WHERE ProjectID='$projID' AND ProjectOrgJosUserID='$DelOrgID' ";
echo "$queryUpdate <br><br>";
mysql_query($queryUpdate);
How do I over come this? Any ideas folks?
Code: Select all
UPDATE tbl_projects SET ProjectTitle='STOP Global Warming', ProjectCostUSD='78999.99', ProjectRegionID='3', ProjectCountry='US', ProjectCatID='4', ProjectBeneficiaryID='9', ProjectStory='
Global warming already disrupts millions of lives daily in the forms of destructive weather patterns and loss of habitat.
What is already happening is only the tip of the melting iceberg, for it is our children and grandchildren who may suffer most from the effects of global warming. Hundreds of millions of people may be exposed to famine, water shortages, extreme weather conditions and a 20 - 30% loss of animal and plant species if we don't reduce the rate of global warming and reduce GHG emissions'. ', ProjectProjectURL='http://www.globalwarming.org', ProjectLIVE='0', ProjectEdit='1', ProjectDelete='0', ProjectLastUpdatedDate='2008-09-25' WHERE ProjectID='7707' AND ProjectOrgJosUserID='944'