When a new user registers, I want to use PHP to create a MySql datbase for them.
However, some charatcers in the user name, might not be suitable (consider O'reilly
).
How can I "sanitize" the username to cerate a valid MySql databse name?
[Update] I could uase @dognose suggestion and user the uer Id in the db name, thus havonf db_1
, db_2
, etc
That certainly solves the special character problem, but it makes it slighly more difficult for me to debug than haviong a human readable name.
Not too much, though. And it solved the duplciate name problem.
What do others do?