PHP - Auto Creation of Database Tables and Insertion of Values

Submitted by: 
Visitors have accessed this post 6304 times.

Greetings from Malawi the Warm Heart Of Africa.
This simple demo project i just want to share with you,so that you can learn how you create database and tables automatically when the index.php or home.php is initiated.

Creating a simple file with your database creation script as well as tables has a number of advatanges.

  1. You dont have to export/import the database everytime you want to share project folder
  2. Its easy to make changes to the database tables during development
  3. Your database is always safe incase the server has been uninstalled from your machine

This project you will also learn how to insert data into tables using modal forms because they are awesome and make your system standout.
How to use this project

  1. Download the zip folder
  2. Extract the folder
  3. Paste the exctracted folder in your server either www or htdocs location
  4. Run the index.php/the project on your browser
  5. The file which contains database and table creation script is saved as db_connect.php

If you have any question regarding this project or anything find me and if you have a website that you own and you would love to know how many people visit your website per day use my web application on this address

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Very informative script. Makes it very easy to setup the database.

How about doing same tutorial for SQLite?

Thanks for sharing!


Thanks i will definately do that and write an email so that when i do i should send you a copy

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.