My script is writing to a text file so it can be cleaned of junk before being uploaded to a Mysql database. I need to selectively remove all characters that would cause a Mysql upload issue while preserving my format for uploading to the database
('column1' , 'column2' , 'column3'),
Above is the structure I need to maintain. So if my data has junk it it, I need it to convert to something that the database can read without it thinking it is code and throw an error at me and stopping the upload. So if raw data looks like
('$%^co--><``lumn1' , 'col[um]n2' , '##colFTumn3'),
I need it to look like
('column1' , 'column2' , 'column3'),
Any ideas on how to write a php code that will open file, clean it, and then put the contents back in the original file?
Basically I need it to remove everything that is not a number, letter or any character that is not found in a URL which would include the // and ? etc