BelovedDoll Posted September 14, 2010 Share Posted September 14, 2010 I am trying to simplify my coding work for my website and wanting to make it operate more professionally (as part of my training to better my programming skills, which I know will take a lot of time to do). One of the things I`d like to improve on it is to create tables and fields in my mysql database, but not have to go into phpmyadmin to do it. I know open source programs like Drupal can do this easily so that when you add modules, the user does not have to access the database to set it up. But looking at the codes, I`m unable to figure out how it works. How will I be able to program my code to do something like, I`ll have a form where I enter in what I want the new table to be called, what fields to add in and their specifications, where I could do this by just going into my website as the admin? Quote Link to comment https://forums.phpfreaks.com/topic/213437-creating-new-tables-and-fields-in-mysql-without-going-to-phpmyadmin/ Share on other sites More sharing options...
WatsonN Posted September 14, 2010 Share Posted September 14, 2010 after you connected use this code: CREATE TABLE table_name ( column_name1 data_type, column_name2 data_type, column_name3 data_type, .... ) For example: $sql = "CREATE TABLE Persons ( FirstName varchar(15), LastName varchar(15), Age int )"; Quote Link to comment https://forums.phpfreaks.com/topic/213437-creating-new-tables-and-fields-in-mysql-without-going-to-phpmyadmin/#findComment-1111182 Share on other sites More sharing options...
BelovedDoll Posted September 14, 2010 Author Share Posted September 14, 2010 Oh wow, that is so simple! Is that really all there is to it? That definitely would save me a lot of time and hassle. Quote Link to comment https://forums.phpfreaks.com/topic/213437-creating-new-tables-and-fields-in-mysql-without-going-to-phpmyadmin/#findComment-1111184 Share on other sites More sharing options...
WatsonN Posted September 14, 2010 Share Posted September 14, 2010 Thats it Quote Link to comment https://forums.phpfreaks.com/topic/213437-creating-new-tables-and-fields-in-mysql-without-going-to-phpmyadmin/#findComment-1111185 Share on other sites More sharing options...
BelovedDoll Posted September 14, 2010 Author Share Posted September 14, 2010 Thanks very much! Is there a source where I can find a list of what specific terms I should use for the different field types? (Like int, varchar, etc?) Quote Link to comment https://forums.phpfreaks.com/topic/213437-creating-new-tables-and-fields-in-mysql-without-going-to-phpmyadmin/#findComment-1111188 Share on other sites More sharing options...
trq Posted September 14, 2010 Share Posted September 14, 2010 http://dev.mysql.com/doc/refman/5.1/en/ Quote Link to comment https://forums.phpfreaks.com/topic/213437-creating-new-tables-and-fields-in-mysql-without-going-to-phpmyadmin/#findComment-1111190 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.