How to Interface PHP and MySQL
PHP is a Web-development scripting language used for generating dynamic Web pages. MySQL is a database server that supports efficient multi-threading (simultaneous user access). PHP and MySQL are considered interfaced when PHP scripts access the information in a MySQL database. Examples of PHP and MySQL collaboration include forums (message boards), banner rotation and database-driven Web designs in which all content and styling is stored in a database instead of HTML.
Things You'll Need
- PHP software
- MySQL software
- Apache software
- ISP/Web hosting
- PHPMyAdmin software (optional)
Instructions
-
-
1
Understand what tools you need. At minimum, you need PHP software, MySQL software, a Web server software such as Apache and a dedicated computer known as "Web host" where the software will be "hosted." This can be your home PC or the remote computer holding the storage space your ISP provides to you.
-
2
Download and install PHP, MySQL and Apache. All are free. You can download PHP from Php.net. MySQL can be obtained from Mysql.com. Apache is available at Apache.org. If you're using a remote Web host, contact your ISP to download, install, configure and troubleshoot all these tools for you. If you're using your home PC, just follow the instructions given on each website.
-
-
3
Obtain the PHPMyAdmin management tool. It is available at Phpmyadmin.net. Install it in your Web host. Although not essential, this tool simplifies administrative tasks by making it possible to view and troubleshoot the database.
-
4
Open a text editor in your Web host. Copy and paste the following script:
< ?
phpinfo();
? >
Save this file as "areinstalled.php."
-
5
Test to see if PHP and MySQL are installed. View "areinstalled.php" from your Web browser. If it gives you installation details about both PHP and MySQL, then they're both installed.
-
6
Populate the MySQL database with data. You may import data from Microsoft Access or Excel. There many places on the Web to find a simple tutorial that can guide you through the steps. One place to find such information is Stardeveloper.com.
-
7
Learn PHP. An excellent online resource is W3schools.com. It provides a tutorial for every PHP function.
-
1