Database Tutorial

How to install the Database in GoDaddy

  1. In GoDaddy, go to the Hosting Control Center. (Note – I set this up on my free GoDaddyhosting account and PHP gave me trouble with posts, so I had to move the PHP to my paid hosting account. The database is still on my free account.)
  2. Go to “Databases” and click on MySQL.
  3. Click on the “Create Database” button and go through the wizard. Once the process is complete and is no longer pending in GoDaddy, you should see the following type of information:
  4. You will need this information and the password you just created in the wizard to access the database in your code.

How to set up the Database

  1. While in the Databases section of the Hosting Control, click on “Manage via phpMyAdmin”. Your login info will be the username that you can see in the above image. By default, it is the name of the database.
  2. Once in the Admin, you can create your tables. Plan your table(s). I used 1 table with names, starting weights, weights for each of the 10 weeks, and percentages for each of the 10 weeks.
  3. If you are not familiar with SQL, I recommend the [W3 SQL Tutorial] page for general SQL info. For more specific help with using MySQL with PHP, I recommend the [W3 PHP MySQL] page.
  4. Here’s how you access the database in php
    $con =  mysql_connect("", "wlc2010","MyPassword");
    if (!$con)
    die('Could not connect: ' . mysql_error());
    mysql_select_db("wlc2010", $con); 
  5. Here’s how you access the table in php
    $result = mysql_query("SELECT * FROM wlc_data WHERE  personID='1' "
    $row1 = mysql_fetch_array($result);
    $name[1] = $row1[name]; [/code]

Author: Steph

Share This Post On

Pin It on Pinterest

Share This