I have been up to recently creating all of my tables through php codes rather than using something like phpMyAdmin. (that’s how it was done in the book I was learning so I just assumed that was the proper way until I started looking through more online tutorials) I have the feeling that this is a bad habit and have started using phpMyAdmin, but was wondering in what kind of situations it would actually be good practice to writing php coded instructions in creating sql tables.
Share
There is no inherent danger to creating tables with php, as long as you are properly doing it. In fact, that’s all phpMyAdmin is – it’s just a php script that does the same thing (only with a fancier interface).
The only real danger here is if you have a habit of leaving your creation scripts laying around and not properly secured. But the same can be said about any script that has access to your database.
But anyways, the advantage of using a tool like phpMyAdmin is that it automates a lot of stuff for you that you probably aren’t otherwise thinking about.
And to answer your question about when is it a good time to do it in general… installation scripts (like cms or forum scripts) usually create tables during setup/install process.