eHow launches Android app: Get the best of eHow on the go.

How To

How to Create Database Websites

Contributor
By Michael Dance
eHow Contributing Writer
(0 Ratings)

Web sites built solely with HTML code might still be fine for personal Web sites with two or three pages, but the Internet is really about data. Whether that data is sales numbers or a member directory or a series of news articles, it's packaged into databases on Web servers and then dynamically served up to visitors with a server-side language like PHP. If that sounds complicated, it's really the opposite. Databases save space, organize information and are much more efficient. And thanks to the multitude of database management tools at your disposal, it's possible to create your own database-driven Web sites.

Difficulty: Moderately Challenging
Instructions

    Steps

  1. Step 1

    Register a domain name for your Web site ("google.com" or "ehow.com," for example) from a domain registrar such as GoDaddy or BlueHost.

  2. Step 2

    Buy a hosting plan. Most domain name registrars (including the two listed above) offer hosting plans as well. Though they come with many different features, make sure you buy one that comes with numerous MySQL databases. MySQL is a popular database management system, installed on your server, that you'll use to store your databases.

  3. Step 3

    Log into your Web site's control panel provided to you by your host. Select the "MySQL" or "Databases" section, and then select the "Add a Database" or "Create New Database" option. This will involve choosing a name for your database and a username and password to access it. On some hosts, the database name and username are the same. Keep this information handy.

  4. Step 4

    Click on your database or select the "Edit Database" option. The vast majority of hosts use a program called phpMyAdmin to manage your databases. This program provides a graphical interface to handle your databases, allowing you to manage them without using SQL code, the database programming language. It can be complicated at first, so browse around until you have a handle on the layout.

  5. Step 5

    Learn SQL code. While phpMyAdmin means you don't have to be an SQL expert, you still need to know how to write basic commands because that's how you put database information in your Web site's files. SQL isn't hard to get a handle on and many tutorials exist on the web. The most comprehensive is W3Schools.

  6. Step 6

    Connect to the databases through PHP files. Think of PHP as like the middle man between basic HTML and your databases. PHP files are simply HTML files with a ".php" extension that can contain extra commands for tasks that HTML can't accomplish. All of these extra commands must start with "<?php" and end with "?>". You'll need to read up on PHP to get a handle on it, but here's the code to make a simple database connection:
    <?php
    $conn = mysql_connect("servername", "username", "password");
    mysql_select_db("databasename");
    ?>

  7. Step 7

    Grab the database information by creating an SQL query, sending it to the database, and storing the results into variables that you can display on pages. The following example will list all the names and values of every field inside a table in your database called "table":
    <?php
    $sql = "SELECT * FROM table";
    $result = mysql_query($sql, $conn) or die(mysql_error());
    while ($row = mysql_fetch_assoc($result)){;
    foreach ($row as $name => $value){
    print "$name: $value<br />";
    } } ?>
    As you can see, writing database coding can get technical very quickly. While this is a look under the hood, rest assured that most people don't program this all on their own--instead, they use a content management system to do most of the coding work for them. A CMS is a program that you install on your server that does most of the coding work for you, allowing you to manage your site's information through a user interface. Joomla! is an example of a free and popular database-driven CMS.

Comments  

Flag This Comment

on 7/20/2009 Hello, People,

please, consider using MyTaskHelper.com

Just want to let you know about new one Free Online Database Application, main benefits and features:

- you can create complex web-forms
- you can put this forms to your site, using Widget Builder menu
- you can create file/image/video databases
- again you can embed Widget-form for adding some records to your site, and another widget for integrating your collected data
- you can add validations, to be sure your users add proper data, for example Email validation, uniqueness etc

for example – you can create form for bug-trucking, with task name/priority, attach screenshot, dates etc,
put it into your site – and you have bug-trucking system for free!
Please, see more on about page.

- And it’s all for FREE

Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Get Free Internet Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy .   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. † requires javascript

Demand Media
eHow_eHow Technology and Electronics