floridaflatlander Posted August 8, 2012 Share Posted August 8, 2012 I have a zip code table and the field for city names has an equal sign in them when there are two or more names like this WHITEHOUSE = STATION I've used phpmyadmin to test/play with seach using LIKE ... WHITEHOUSE STATION, WHITEHOUSE =STATION, WHITEHOUSE =\nSTATION, WHITEHOUSE = STATION, and get no result. This seems like it would mess up searches, why would they have equal signs in the city names and how would I search for something like WHITEHOUSE STATION when it's WHITEHOUSE = STATION? There are 8,637 records with an equal sign in the city names. How can I search for a city with an equal sign in the name or can I REPLACE(remove) the equal sign and it's new line charactor(if that's what it is) like this? UPDATE zip_codes set city = replace (city, ' =\n', ' '); Any thoughts, thanks. Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 8, 2012 Share Posted August 8, 2012 Should any of the records have the = sign? Did you check for "\r\n" instead of just "\n" Quote Link to comment Share on other sites More sharing options...
floridaflatlander Posted August 8, 2012 Author Share Posted August 8, 2012 Odd when I use $q = "SELECT * FROM zip_codes WHERE city LIKE 'WHITEHOUSE =\r\nSTATION'"; on a php file page I made it works and returns WHITEHOUSE = STATION when I use WHITEHOUSE =\r\nSTATION using my phpmyadmin search it returns "returned an empty result set" and ... SELECT * FROM `zip_codes` WHERE `city` LIKE 'WHITEHOUSE =\\r\\nSTATION' with the extra back slashes in the query. Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 8, 2012 Share Posted August 8, 2012 So try using that php page to do UPDATE zip_codes set city = replace (city, ' =\r\n', ' '); and it should erase them. Then you need to figure out where the bad data came from. Quote Link to comment Share on other sites More sharing options...
floridaflatlander Posted August 8, 2012 Author Share Posted August 8, 2012 Thanks for the reply The data came from here http://federalgovernmentzipcodes.us/ the smaller file, it's a csv file and I checked they're in the csv file. So this is an error and isn't suppose to be like this? Anyway I don't see why there would be an equal sign in the city field. I think I can fix this easy enough, I'll be back and mark solved when done. Thanks Quote Link to comment Share on other sites More sharing options...
floridaflatlander Posted August 8, 2012 Author Share Posted August 8, 2012 No I just down loaded a new csv file and it wasn't in it, so something must of messed up the first time I did it. Thanks Quote Link to comment Share on other sites More sharing options...
floridaflatlander Posted August 8, 2012 Author Share Posted August 8, 2012 Okay uploaded the new csv file to my db table and the equal sign is gone. Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.