Web Developer
PHP & MySQL
PHP will work with virtually all database software, including Oracle and Sybase but most commonly used is freely available MySQL database.
What you should already have ?
You have gone through MySQL tutorial to understand MySQL Basics.
Downloaded and installed a latest version of MySQL.
Created database user guest with password guest123.
If you have not created a database then you would need root user and its password to create a database.
We have divided this chapter in the following sections −
Connecting to MySQL database − Learn how to use PHP to open and close a MySQL database connection.
Create MySQL Database Using PHP − This part explains how to create MySQL database and tables using PHP.
Delete MySQL Database Using PHP − This part explains how to delete MySQL database and tables using PHP.
Insert Data To MySQL Database − Once you have created your database and tables then you would like to insert your data into created tables. This session will take you through real example on data insert.
Retrieve Data From MySQL Database − Learn how to fetch records from MySQL database using PHP.
Using Paging through PHP − This one explains how to show your query result into multiple pages and how to create the navigation link.
Updating Data Into MySQL Database − This part explains how to update existing records into MySQL database using PHP.
Deleting Data From MySQL Database − This part explains how to delete or purge existing records from MySQL database using PHP.
Using PHP To Backup MySQL Database − Learn different ways to take backup of your MySQL database for safety purpose.
PHP interaction
PHP started out as a small open source project that evolved as more and more people found out how useful it was. Rasmus Lerdorf unleashed the first version of PHP way back in 1994.
PHP is a recursive acronym for "PHP: Hypertext Preprocessor".
PHP is a server side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking, even build entire e- commerce sites.
It is integrated with a number of popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.
PHP is pleasingly zippy in its execution, especially when compiled as an Apache module on the Unix side. The MySQL server, once started, executes even very complex queries with huge result sets in record-setting time.
PHP supports a large number of major protocols such as POP3, IMAP, and LDAP. PHP4 added support for Java and distributed object architectures (COM and CORBA), making n-tier development a possibility for the first time.
PHP is forgiving: PHP language tries to be as forgiving as possible.
PHP Syntax is C-Like.
How to Install Apache Web Server on Windows
What is a Web Server?
Why Apache?
All-in-One packages
The Apache Installation Wizard
Manual Installation
- backing up, reinstalling, or moving the web server can be achieved in seconds
- you have more control over how and when Apache starts
- you can install Apache anywhere, such as a portable USB drive (useful for client demonstrations).
Step 1: configure IIS, Skype and other software (optional)
Step 2: download the files
Step 2: extract the files
Step 3: configure Apache
Listen *:80
LoadModule rewrite_module modules/mod_rewrite.so
ServerName localhost:80
AllowOverride All
Step 4: change the web page root (optional)
DocumentRoot "D:/WebPages"
<Directory "D:/WebPages">
Step 5: test your installation
cd Apache2bin
httpd -t
Step 6: install Apache as a Windows service
cd Apache2bin
httpd -k install
Step 7: test the web server
<html>
<head><title>testing Apache</title></head>
<body><p>Apache is working!</p></body>
</html>
- See also:
- How to Install PHP
- How to Install MySQL
- MySQL: the Pros and Cons of MyISAM Tables
- MySQL: the Pros and Cons of InnoDB Tables
- How to Use MySQL Foreign Keys for Quicker Database Development
How to Install PHP on Windows
Why PHP?
Why Install PHP Locally?
All-in-One packages
The PHP Installer
Manual Installation
- backing up, reinstalling, or moving the web server can be achieved in seconds (see 8 Tips for Surviving PC Failure) and
- you have more control over PHP and Apache configuration.
Step 1: download the files
Step 2: extract the files
Step 3: configure php.ini
extension_dir = "C:phpext"
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo.dll
extension=php_pdo_mysql.dll
extension=php_xmlrpc.dll
mail()
function, enter the details of an SMTP server (your ISP’s server should be suitable):
[mail function]
; For Win32 only.
SMTP = mail.myisp.com
smtp_port = 25
; For Win32 only.
sendmail_from = my@emailaddress.com
Step 4: add C:php to the path environment variable
Step 5: configure PHP as an Apache module
DirectoryIndex index.php index.html
# PHP5 module
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"
cd Apache2bin
httpd -t
Step 6: test a PHP file
<?php phpinfo(); ?>
- How to Install Apache
- How to Install MySQL
- MySQL: the Pros and Cons of MyISAM Tables
- MySQL: the Pros and Cons of InnoDB Tables
- How to Use MySQL Foreign Keys for Quicker Database Development
-
Click Here! What is a Web Server? A web server is software that listens for requests and returns data (usually a file). When you ty...
-
PHP will work with virtually all database software, including Oracle and Sybase but most commonly used is freely available MySQL database. W...