I need to ensure no commas are saved in a particular MySQL table. Is there a way to do this within the database itself without using PHP code on the web server prior to the data being past to the DB? I was thinking perhaps a stored procedure (not sure if this is what they're called in MySQL). I would really appreciate any help on this.
before adding data to the database, i sincerely hope your application code checks for and prevents sql injection
that's where you can remove the commas as well
Good point. The application is checking to prevent sql injections. I will begin there. Thanks for pointing me in the right direction.
INSERT INTO tablex VALUES (REPLACE("mycomma,test text, haha", ",", " "));
that should work I think.
But yes, you should really clean the inputs before you get to this stage.
This topic is now archived. It is frozen and cannot be changed in any way.