www.PHPBuddy.com
 PHP Function Lookup:
 
Categories
PHP Quick Start
PHP Installation
PHP Articles
PHP Scripts

Top Rated Articles 

Site Related
Submit Articles/Code
Contact Us
Home

   Home                   Article Added on: April 7, 2002
A sample PHP page that connect to MySQL

Overview: Here we will be connecting to MySQL database (mybuddy) and retrive data from that database.

If you havent installed phpMyAdmin till now its a good time to configure that as it will make your life working with databases really easy!


Before we continue we need to add a table with some data, I have made a sample table (guest_book) with some sample data, below is the dump that will create the table (guest_book) with some sample data.



Okay now we have a table 'guest_book' let's write some php code to access the data from the MySQL database.

I will again be storing these files under the mybuddy virtual directory that we had created earlier.

data1.php View Sample Output

Run this code from your machine!
* This above option is applicable only if you have saved the file (data1.php) under the virtual directoy mybuddy

See how easy it is to connect to a MySQL database and access data with PHP. If nothing above makes any sense to you please refer to the PHP tutorials sections.

    Send this Article to your Friend!
Your Name Friend's Email
 
Rate this article:  Current Rating: 3.67
  Poor    Excellent     
          1     2    3    4    5


Other Related articles:

 

Home | Privacy Policy | Contact Us | Terms of Service
(c) 2002 - 2019 www.PHPbuddy.com Unauthorized reproduction/replication of any part of this site is prohibited.