Actual for You
#1 in Business Subscribe Email Print

You are here: Home > Internet and Businesses Online > Web Development > Introduction to MySQL with PHP

Tags

  • varchar
  • those
  • phone
  • sectionthe contacts
  • whole creation
  • following fields

  • Links

  • Renting a Villa in Holland
  • Attention - Home Business Owner - Are You A Time Waster
  • The Fear Of Giving A Best Man's Speech At My Brother's Wedding
  • Actual for You - Introduction to MySQL with PHP

    The Overture Bid Tool May Be Another Wake-Up Call
    The loss of the Overture bid tool is creating a major slow down for those depending on adsense sites as their sole source of business income on the internet.This should serve as a major wake-up call to internet marketers. Diversify or you may find your income resources drying up.In the business world whether it is offline or online businesses cycle from season to season and year to year. For some businesses the impact is far greater than for others.Tax, debt relief and personal finance sites should be in their best season right now. People tend to stop and take stock of their general financial condition during tax season. Once April 15th arises the peak will be over for another ye
    ---------------------------------------------------------------------------------------- The fields are defined as follows:

    fieldname type(length) extra info,

    The final field entered should not have a comma after it.

    I will give full an example of using these later in the section.

    The Contacts Database

    The contacts database will contain all the conact information for the people you enter and the information will be able to be edited and viewed on the internet. The following fields will be used in the database:

    Name Type Length Description
    id INT 6 A unique identifier for each record<

    How to Make Money Marketing Affiliate Products
    Everybody dreams of being rich! Some of us don't just want to be rich... We want to be rich beyond our wildest dreams! We want to be able to live like the rich and famous, and we want our riches to continue for the rest of our natural lives.Anyone who is truly wealthy will tell you that you never get rich working for someone else. To make the kind of money you need to live a wealthy lifestyle you have to be in command of your own destiny, or marry well. Marrying well is okay I suppose, but it carries consequences. Going into business for yourself also carries some risks, but the risks are usually under your control. You’re at the helm and you sink or swim on your own performance.The curr
    Before you actually start building your database scripts, you must have a database to place information into and read it from. In this section I will show you how to create a database in MySQL and prepare it for the data. I will also begin to show you how to create the contacts management database.

    Database Construction

    MySQL databases have a standard setup. They are made up of a database, in which is contained tables. Each of these tables is quite separate and can have different fields etc. even though it is part of one database. Each table contains records which are made up of fields.

    Databases And Logins

    The process of setting up a MySQL database varies from host to host, you will however end up with a database name, a user name and a password. This information will be required to log in to the database.

    If you have PHPMyAdmin (or a similar program) installed you can just go to it to log in with your user name and password. If not you must do all your database administration using PHP scripts.

    Creating A Table

    Before you can do anything with your database, you must create a table. A table is a section of the database for storing related information. In a table you will set up the different fields which will be used in that table. Because of this construction, nearly all of a site's database needs can be satisfied using just one database.

    Creating a table in PHPMyAdmin is simple, just type the name, select the number of fields and click the button. You will then be taken to a setup screen where you must create the fields for the database. If you are using a PHP script to create your database, the whole creation and setup will be done in one command.

    Fields

    There are a wide variety of fields and attributes available in MySQL and I will cover a few of these here:

    Field Type Description
    ======== ==========
    TINYINT Small Integer Number
    SMALLINT Small Integer Number
    MEDIUMINT Integer Number
    INT Integer Number

    VARCHAR Text (maximum 256 characters)
    TEXT Text

    These are just a few of the fields which are available. A search on the internet will provide lists of all the field types allowed.

    Creating A Table With PHP

    To create a table in PHP is slightly more difficult than with MySQL. It takes the following format: -------------------------------------------------------------------------------------------------------------- CREATE TABLE tablename {

    Fields

    } -------------------------------------------------------------------------------------------------------------- The fields are defined as follows:

    fieldname type(length) extra info,

    The final field entered should not have a comma after it.

    I will give full an example of using these later in the section.

    The Contacts Database

    The contacts database will contain all the conact information for the people you enter and the information will be able to be edited and viewed on the internet. The following fields will be used in the database:

    Name Type Length Description
    id INT 6 A unique identifier for each record Made for Adsense (MFA) Sites Contribute to Web Content Pollution
    I recently read a Christian Science Monitor article called "Google's Hidden Payroll" which looks at the economic incentive for tech-savvy third world entrepreneurs to get into publishing extensive web content and enter the Google Adsense or Yahoo Publisher Network (YPN) game. What should be obvious is that clicks on Adsense ads will be worth far more to site publishers in low-wage countries than they are to someone in high rent, high wage cities like San Francisco, Los Angeles, Manhattan or Chicago.http://snipurl.com/Made_for_adsense (CS Monitor Article)That article made it appear that the entire Adsense program w

    etting up a MySQL database varies from host to host, you will however end up with a database name, a user name and a password. This information will be required to log in to the database.

    If you have PHPMyAdmin (or a similar program) installed you can just go to it to log in with your user name and password. If not you must do all your database administration using PHP scripts.

    Creating A Table

    Before you can do anything with your database, you must create a table. A table is a section of the database for storing related information. In a table you will set up the different fields which will be used in that table. Because of this construction, nearly all of a site's database needs can be satisfied using just one database.

    Creating a table in PHPMyAdmin is simple, just type the name, select the number of fields and click the button. You will then be taken to a setup screen where you must create the fields for the database. If you are using a PHP script to create your database, the whole creation and setup will be done in one command.

    Fields

    There are a wide variety of fields and attributes available in MySQL and I will cover a few of these here:

    Field Type Description
    ======== ==========
    TINYINT Small Integer Number
    SMALLINT Small Integer Number
    MEDIUMINT Integer Number
    INT Integer Number

    VARCHAR Text (maximum 256 characters)
    TEXT Text

    These are just a few of the fields which are available. A search on the internet will provide lists of all the field types allowed.

    Creating A Table With PHP

    To create a table in PHP is slightly more difficult than with MySQL. It takes the following format: -------------------------------------------------------------------------------------------------------------- CREATE TABLE tablename {

    Fields

    } -------------------------------------------------------------------------------------------------------------- The fields are defined as follows:

    fieldname type(length) extra info,

    The final field entered should not have a comma after it.

    I will give full an example of using these later in the section.

    The Contacts Database

    The contacts database will contain all the conact information for the people you enter and the information will be able to be edited and viewed on the internet. The following fields will be used in the database:

    Name Type Length Description
    id INT 6 A unique identifier for each record<

    Sorry, No Customer Service After 4:00 P.M.
    A few months ago, I wrote about ingenious styles of customer service that every business should know about, mostly because their employees were inflicting them on their customers.For instance, I warned about "in your face customer service" and "run for cover customer service", two equally effective opposites...like pouring too much sugar on your Cheerios one day, and pouring too much cayenne pepper on them the next.I also warned about "do-it-yourself-extortion", "consistent filibuster customer service", "Invisible Man customer service", "present-at-attendance customer service", "customer service on steroids", and "satirical customer service".You will have to read about these cleve
    construction, nearly all of a site's database needs can be satisfied using just one database.

    Creating a table in PHPMyAdmin is simple, just type the name, select the number of fields and click the button. You will then be taken to a setup screen where you must create the fields for the database. If you are using a PHP script to create your database, the whole creation and setup will be done in one command.

    Fields

    There are a wide variety of fields and attributes available in MySQL and I will cover a few of these here:

    Field Type Description
    ======== ==========
    TINYINT Small Integer Number
    SMALLINT Small Integer Number
    MEDIUMINT Integer Number
    INT Integer Number

    VARCHAR Text (maximum 256 characters)
    TEXT Text

    These are just a few of the fields which are available. A search on the internet will provide lists of all the field types allowed.

    Creating A Table With PHP

    To create a table in PHP is slightly more difficult than with MySQL. It takes the following format: -------------------------------------------------------------------------------------------------------------- CREATE TABLE tablename {

    Fields

    } -------------------------------------------------------------------------------------------------------------- The fields are defined as follows:

    fieldname type(length) extra info,

    The final field entered should not have a comma after it.

    I will give full an example of using these later in the section.

    The Contacts Database

    The contacts database will contain all the conact information for the people you enter and the information will be able to be edited and viewed on the internet. The following fields will be used in the database:

    Name Type Length Description
    id INT 6 A unique identifier for each record<

    Fresh Off The (Desi) Boat
    Stepping on the land of hope and liberty is a dream for all who are born with a human heart and mind. The excitement encroaches all spheres of ones mind the day he/she starts preparing for it. There are hindrances, road-blocks and cumbersome paper works to be done to get the visa (no matter what type) to enter into this country. The hopeful he or she gets relaxed and relieved when the visa is through. But NO! Thats not the end of it. The struggle and responsibilities increase exponentially starting from that day onwards.Dreams come true is always valid for guys with guts. The land of hope and opportunity gives you all that you want if you deserve it. You need to be brave, adventurous, willing t
    SMALLINT Small Integer Number
    MEDIUMINT Integer Number
    INT Integer Number

    VARCHAR Text (maximum 256 characters)
    TEXT Text

    These are just a few of the fields which are available. A search on the internet will provide lists of all the field types allowed.

    Creating A Table With PHP

    To create a table in PHP is slightly more difficult than with MySQL. It takes the following format: -------------------------------------------------------------------------------------------------------------- CREATE TABLE tablename {

    Fields

    } -------------------------------------------------------------------------------------------------------------- The fields are defined as follows:

    fieldname type(length) extra info,

    The final field entered should not have a comma after it.

    I will give full an example of using these later in the section.

    The Contacts Database

    The contacts database will contain all the conact information for the people you enter and the information will be able to be edited and viewed on the internet. The following fields will be used in the database:

    Name Type Length Description
    id INT 6 A unique identifier for each record<

    Making Money Online Doing Freelance Work
    Anyone who is able to operate a computer, has an internet connection, and is well organized can find plenty of freelance work to do from home. It is an excellent way to make money when you are able to work.You can do it part time, full time, as a way to make extra income, or to pay off existing debts you have. There are many different types of freelance work that you can choose from including data entry, writing articles, proofreading, translating, transcribing, marketing, website design, and computer troubleshooting.There are a variety of online freelance sites that allow those needing this type of work to list it at no charge. You simply sign up at the sites and choose the type of work
    ---------------------------------------------------------------------------------------- The fields are defined as follows:

    fieldname type(length) extra info,

    The final field entered should not have a comma after it.

    I will give full an example of using these later in the section.

    The Contacts Database

    The contacts database will contain all the conact information for the people you enter and the information will be able to be edited and viewed on the internet. The following fields will be used in the database:

    Name Type Length Description
    id INT 6 A unique identifier for each record
    first VARCHAR 15 The person's first name
    last VARCHAR 15 The person's last name
    phone VARCHAR 20 The person's phone number
    mobile VARCHAR 20 The person's mobile number
    fax VARCHAR 20 The person's fax number
    email VARCHAR 30 The person's e-mail address
    web VARCHAR 30 The person's web address

    You may be wondering why I have used VARCHAR fields for the phone/fax numbers even though they are made up of digits. You could use INT fields but I prefer to use VARCHAR as it will allow dashes and spaces in the number, as well as textual numbers (like 1800-COMPANY) and as we will not be initiating phone calls from the web it is not a problem.

    There is one other thing you should be aware of in this database. The id field will also be set as PRIMARY, INDEX, UNIQUE and will be set to auto_increment (found under Extra in PH PMyAdmin). The reason for this is that this will be the field identifier (primary and index) and so must be unique. The auto increment setting means that whenever you add a record, as long as you don't specify an id, it will be given the next number.

    If you are using PHPMyAdmin or a management program you can now create this in a table called contacts.

    Creating The Table In PHP

    The following code should be used to create this table in PHP. Some of the code has not been covered yet but I will explain it fully in the next part. -------------------------------------------------------------------------------------------------------------


    $user="username";

    $password="password";
    $database="database";
    mysql_connect(localhost,$user,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    $query="CREATE TABLE contacts (id int(6) NOT NULL auto_increment,first varchar(15) NOT NULL,last varchar(15) NOT NULL,phone varchar(20) NOT NULL,mobile varchar(20) NOT NULL,fax varchar(20) NOT NULL,email varchar(30) NOT NULL,web varchar(30) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))";

    mysql_query($query);
    mysql_close();

    ------------------------------------------------------------------------------------------------------------- Enter your database, MySQL username and MySQL password in the appropriate positions on the first three lines above.

    HTTP = HTML link (for blogs, profiles,phorums):
    <a href="http://www.actual4u.com/article/87320/actual4u-Introduction-to-MySQL-with-PHP.html">Introduction to MySQL with PHP</a>

    BB link (for phorums):
    [url=http://www.actual4u.com/article/87320/actual4u-Introduction-to-MySQL-with-PHP.html]Introduction to MySQL with PHP[/url]

    Related Articles:

    If You Ignore The Internet For Your Business You Are Setting Yourself Up For Failure

    Your Five Step Plan to Solving Career Dread

    Measuring Training Effectiveness: How to Get Started

    Bookmark it: del.icio.us digg.com reddit.com netvouz.com google.com yahoo.com technorati.com furl.net bloglines.com socialdust.com ma.gnolia.com newsvine.com slashdot.org simpy.com shadows.com blinklist.com