I’m trying to get rid of double spaces or paragraph spaces from a column in the database that has the input from front end client display.
Whats happening is that the client wants to upload an excel file and their software doesnt like it when there is like a double space between words or the user has clicked enter to create a paragraph. Its fine that they do that their side, but before being exported to a csv file I wanted to basically clear any whitespace over a single space to a single space, and I thought I would do it the way below using REPLACE, but it doesnt like it.
$x="select Name, Employerofperson, Contactphone, Location, DATE_FORMAT(DateOccured, '%e-%c-%Y %H:%i') as DateOccurred, ProductionZone, ".REPLACE(NearMissDetails, " ", " ").", ".mysql_real_escape_string(Anyimmediateactions).", HazardorNearMiss, Primarycause, Rottcause, Behaviours, PotentialOutcome, Likelihood, Comments, PersonsMostLikelyInjured, CloseDate, HighPotentialIncident, HPIInvestigatedBy, BUHSELeader, BUSectorLeader, HPIInvestigationConclusion, HPIBriefingNoteRef, HPIInvestigationCloseOutDate FROM hazzard WHERE ".$sqlstar." ORDER by DateOccured ASC";