Using PHP to Send an E-mail
Sending an e-mail in PHP is another relatively simple task. An e-mail is sent through PHP using the mail() function.
mail($address, $subject, $body);
When using this function, $address should contain the e-mail address of the recipient. $subject should contain the subject heading of the e-mail. $body should contain the actual contents of the e-mail.
The following is an example of code that uses the mail() function:
mail(anooprajiv@perfectrecipie.com,"My Subject", "Line1 \n Line2 \n Line3");
Note that, in the above example, /n is used to separate the different lines in the body of the e-mail. Since sending an e-mail that contains only one line would be inefficient, it is important to use these constructions to make larger e-mails easier to read.
Another common operation is concatenate-equals (.=). This operation takes the contents of the variable to the left of the operator and concatenates it with whatever is to the right. For example, consider the following code:
$example1 = "African";
$example2 = "bamboo";
$example1 .= $example2;
After executing this code, the variable $example1 will contain the string “Africanbamboo“. Below, we can see an example of how this would be used in the
mail() function:
$mailto = $email;
$subject = "Thank you for signing up for our conference";
$body = "Hello ".$fname." ".$lname.",\n\n";
$body .= "Thank you for registering for our conference on \n";
$body .= "Aug 1st, 2007 at IKM. We hope that this\n";
$body .= "will be an enjoyable experience. We look foreword to \n";
$body .= "seeing you there.\n\n";
$body .= "Thank You,\n";
$body .= "The Management\n";
mail($mailto,$subject,$body);
Be creative! You can use information collected from forms as well as other data to send an e-mail to yourself or to a visitor that has just filled out a survey.
Locating the MYSQL database from your hardisk
The MYSQL database is stored in the location \mysql x.x\data\ by default.
eg: If you have installed MYSQL in Program files folder of the root directory (C:\Program files\MYSQL) then open up the folder C:\Program files\MYSQL\data to locate the database files.
—————————————————————————
INSTALLING PHP 5.2.1 ON WINDOWS XP
—————————————————————————
Step 1:Download the PHP 5.2.1 Package
Step 2: Unzip the contents of the zip file to a new folder named ‘PHP5′ in your root directory (i.e C:\). The folder path will now look something like C:\PHP5.
IF YOU HAVE IIS INSTALLED ON YOUR MACHINE THEN YOU CAN SKIP THE FOLLOWING STEP(STEP 3) AND JUMP TO THE NEXT STEP (STEP 4)
Step 3: Now get your Windows xp sp2 cd and place it in your cdrom drive. If the cd auto runs then click the option for ‘installing additional components’. Then check the components for ‘internet information services’ and ‘network services’. This will install IIS 5.1 on your OS.
Step 4: To check wheather IIS is installed properly on your OS, go to your IE browser and in the address bar type, http://localhost/. If this opens something i.e., IIS default page and IIS help page then think that iis has been installed properly.
Step 5: Now in your php5 directory, rename php.ini-dist as php.ini and open it in the text editor like notepad.exe. Find the line ‘doc_root=’ and replace it with ‘doc_root = C:\Inetpub\wwwroot’. Find ‘extension_dir =’ and replace it with extension_dir = “C:\php5\ext”. Find ;cgi.force_redirect = 1 and replace it with cgi.force_redirect = 0. Save the file and make a copy of this file and back it up and also place a copy of this file viz. ‘php.ini’ in the windows directory.
Step 6: Ok we are done with configuring the PHP. Its time to configure the IIS. Ok, So, open the IIS gui(start>control panel>performance and maintainance>administrative tools> internet information services(shortcut) or start>run>type”C:\WINDOWS\system32\inetsrv\iis.msc” ofcourse w/o quotes.
Step 7: Now a dialog will appear. Right click on “Default Website” on the left side window of the dialog. Click properties from the pull-down menu. An other dialog box will appear with the title Website Properties.
Step 8: From that dialog box goto ISAPI filter tab. In the ISAPI filter tab click add. Type filter name as PHP and executable as C:\php5\php5isapi.dll. Click OK once.
Step 9: In the same dialog, go to “Home Directory” tab, click “configuration…” click add, type executable as ‘C:\php5\php-cgi.exe’ and extension as “.php”. If not, check the boxes for “script engine” and “check that the file exists”. Click OK.
Step 10: Then make sure that the check box for “chache ISAPI applications” is checked. Now click ok.
Step 11: Now go to the tab “Documents”.Click “Add”, then for “Add the default document page” type “index.php”. Then click OK. Move ‘index.php’ on to the top. Also make sure that “enable default document” is checked.
Step 12: Now click OK till you return to the main dialog. Click the top most computer icon in the left window of the dialog, which displays your computer name.
Step 13: From the menu bar, click “Action>All tasks>Restart IIS…”. This is the safe way to restart the server. Thats all for configuring IIS.
Step 14: So you are now ready to script in php. Dont forget to save all your web pages in the directory C:\Inetpub\wwwroot.
Step 15: Now to check whether php has been installed properly a little coding is needed. Create a new php page and copy the following code
<?php
phpinfo();
?>
and save this as ‘index.php’ and put it in C:\Inetpub\wwwroot folder. Fireup Internet explorer and type http://localhost/index.php. If it shows the configuartion page of PHP then you’re done. Hurray!!! PHP is installed on your machine.
Note: If you find any difficulty in getting things done with the PHP installation, do feel free to contact me on anuprajeevan@yahoo.com
————————————————–
INSTALLING MYSQL 5
————————————————–
The MySQL functions allows you to access MySQL database servers through PHP
——————————————————————————————————————————
A step by step guide to installing MYSQL 5
Step 1: Go to the MySQL website and download the installer. You want the Windows (x86) version (you’ll have to scroll down a bit to see it — don’t confuse it with the Windows Essentials version). Note the MD5 checksum, which we’ll use in step 2. Choose a mirror that is a close to you as possible and download the zip file (or just click “Download” and one will be chosen for you).
Step 2: Check the MD5 checksum with the value they have next to the download link on the site.
md5sums -p -n -b mysql-5.0.18-win32.zip
If it checks out, unzip the file (this will produce a file called Setup.exe), and delete the zip file after it’s done. If the checksum does not match, download again from another mirror.
Step 3: To install the MySQL package, follow the subsequent steps: Execute the mysql-5.1.3-Setup.exe file from the ZIP file to begin the installation process. At the first screen, simply press ‘Next‘.

Step 4: At the following screen, choose either ‘Typical‘ or ‘Complete‘. Advanced users may choose ‘Custom‘. If you are unsure, choose ‘Typical’. Its always advisable to choose ‘Complete‘ as the installation option. Once you have made your selection, press the `Next‘ button.

Step 5: At the next screen, review your selections. When you are sure that you have made the correct choices, press the ‘Install‘ button. If you want to make changes, use the `Back‘ button to go back and correct your previous choices.

Step 6: Once the installation process has completed, you will be asked to sign up for or log in to a MySQL.com account. This manual does not cover the processes that those choices would entail. Make your choice and select the ‘Next‘ button

Step 7: Ensure that the ‘Configure the MySQL Server now’ checkbox is checked on the next screen and press ‘Finish‘ to continue on to the configuration phase.

Step 8: Configuring MySQL 4.1.8
To begin the configuration process, simply press the ‘Next‘ button.

Step 9: On the next screen, choose the ‘Detailed Configuration’ option and press the ‘Next‘ button

Step 10: The following screen asks you to select a server type. Choose an option that is appropriate to your needs, or select ‘Developer Machine‘ if you are unsure. When you have made your choice, press the ‘Next‘ button.

Step 11: When prompted for the type of database usage, please choose ‘Non-transactional Database Only’. (The MyISAM format stores each table as a set of three files: a .frm, a .MYD, and a .MYI file. The InnoDB format does not use these files.) Press the ‘Next‘ button.

Step 12: On the next screen, select the option that is best for you. The values shown below are reasonable (‘Manual Setting’ and 200 users). When you have made your choices, press the ‘Next‘ button

Step 13: When asked to set networking options, leave the defaults and press the ‘Next‘ button

Step 14: On the following screen, make sure the ‘Standard Character Set’ option is selected and proceed by pressing the ‘Next‘ button.

Step 15: When asked to set Windows options, check ‘Include Bin Directory in Windows PATH’. The rest of the defaults are correct. Press the ‘Next‘ button.

Step 16: On the next screen, enter your password twice into the provided fields and press ‘Next‘. If you cannot press ‘Next‘, the passwords do not match and must be re-entered.

Step 17: Press ‘Execute‘ on the next screen to apply the configuration.

Step 18: Finally, press the ‘Finish‘ button once all the changes have been applied.

Step 19: Open Start > Programs > MySQL > MySQL Server 4.1 > MySQL Command Line Client and enter the password you entered in the configuration step. Enter each of the three commands exactly as shown below, replacing each instance of your_password with the password you chose before.
GRANT create, delete, drop, index, insert, select, update, alter,
create temporary tables, file, reload ON *.*
TO root @ localhost IDENTIFIED BY 'your_password';
SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('your_password');
FLUSH PRIVILEGES;
After completing this step, close the MySQL Command Line Client window.


