Should I use phpmyadmin or php to add content a to a database?
My knowledge of MySQL is very basic here..开发者_如何学C. so I'm just wondering if I want to create a table in a database, and add rows to that table, is it best to do so through phpmyadmin or should I do so in a PHP file?
Of course you can do it programmatically, maybe for your project you'll have to do it later anyway. But to get used to this whole SQL stuff, maybe it would be better to use some administration tool, like the mentioned phpMyAdmin or MySQL Workbench. I wouldn't recommend the commandline tool for starting, except you like a puristic commandline environment.
I just found this phpMyAdminDemo. Maybe it's good to start with, if you really want to use PHPMyAdmin. But if you don't have to, I would recommend to use Mysql Workbench, because it has a nice user interface and I hope it's relatively easy to deal with. A really nice feature is, that you can create diagrams of your database in the GUI, and forward it to the database. Even if you modify the diagram (e.g. adding columns), you can synchronize it with the database with only a few clicks. Additionally to that you can enter and edit data with Workbench as well.
So you might have a basic database structure then - after you struggled through some select statements in PHP like in PHP MySQL Select you will maybe finally get to the point where you want to: Like creating tables with PHP and MySQL or inserting data with PHP and MySQL
[Edit] I re-read your question as your title and question don't match. To answer your question; Creating the database schema is what phpmyadmin was made for. For managing data see what I wrote below.
Depends on your situation. If there's only you and just you managing the content then it can be an easy way to insert and edit data quickly. If you want to do anything advanced, for example:
- WYSIWYG (HTML editing) or
- Validation
then you'll need to make something yourself. I wouldn't recommend you have a client using a CMS to edit through phpmyadmin as they're given too much power and could screw things up.
I'd suggest using phpmyadmin as its pretty easy for novice users. Here is a very detailed article to add a table in phpmyadmin - http://php.about.com/od/learnmysql/ss/create_tables.htm
精彩评论