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.
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.
| Terms of Service
(c) 2002 - 2018 PHPbuddy.com Unauthorized reproduction/replication of any part of this site is prohibited.