23.03.2017 Views

wilamowski-b-m-irwin-j-d-industrial-communication-systems-2011

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Development of Interactive Web Pages 62-3<br />

You can download the latest WAMP server software from the following Web site: http://www.<br />

wampserver.com/en/download.php.<br />

After you download the package, double click on the executable file and choose a destination path (by<br />

default c:\wamp) for the software to be installed on your computer. Follow the instructions provided on<br />

the Web site and everything will be easily installed. Once the software is installed, you can add other<br />

releases of PHP, MySQL, and Apache by downloading them from their Web sites, and you will be able<br />

to easily switch between releases. After WampServer is installed, a tray icon to manage your server is<br />

shown at right end of the taskbar. By left clicking on the icon, you will see a menu to manage your server<br />

settings. Once you install WampServer, a “www” directory is created (c:\wamp\www) and you will see an<br />

“index.php” file in it. Do not modify this file because the software recognizes it as its default homepage.<br />

Create a directory inside it and store all your PHP or HTML files in it. To create a database, you can follow<br />

the traditional method by opening the SQL console and typing the commands that will create your<br />

database. Another way of creating databases and handling the administration of one or more MySQl<br />

servers is through phpMyAdmin. PhpMyAdmin is an open-source tool intended to create, modify, or<br />

delete databases, tables, fields, or rows; executing SQL statements; or managing users and permissions.<br />

62.3 Introduction to PHP<br />

A PHP script can be easily embedded into HTML by enclosing the code with PHP tags, < ?php and ? >,<br />

which is similar to HTML tags.<br />

A PHP scripting block can be placed anywhere inside the HTML document.<br />

Example:<br />

<br />

<br />

<br />

<br />

<br />

Save the HTML file as “test.php” or you can open a notepad, copy the code, and save it as “test.php.”<br />

62.3.1 Variables<br />

All variables in PHP start with the “$” sign followed by the name of the variable. PHP variables are used to<br />

store information and can be used wherever they are needed in the script; like text strings, numbers, or arrays.<br />

Example:<br />

<br />

Output of above code: Welcome 20.5<br />

PHP also provides “print_r” function to display the variable contents.<br />

© <strong>2011</strong> by Taylor and Francis Group, LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!