Appendix C. PHP Basics

IN THIS CHAPTER

Language Elements and Syntax

The PHP Scripts

Summary

PHP is a mature and powerful server-side scripting language, but our shallow usage of it in this book is concerned with one simple goal: bridging a Flex 4 application to a MySQL database. As such, the PHP files we present are mere outboard functions, stored on the server and waiting for the ContactManager application created in Chapter 16 and Chapter 17 to call them to either retrieve data from or submit data to a MySQL database.

The following PHP primer addresses PHP with our immediate goals in mind. First, we cover PHP basics, including the structure of a PHP file, how to declare variables, how to concatenate strings, and the ever-essential PHP MySQL functions. Once you’re familiar with the very, very basics, we discuss the actual PHP scripts we’ll use with the ContactManager application from Chapter 16 and Chapter 17.

Language Elements and Syntax

The first section of our PHP primer is concerned with the anatomy of a PHP file and the scripting essentials you’ll need to create and understand the scripts used by the ContactManager application.

PHP Files

PHP files should be appropriately named and end with the .php extension. Although PHP files can be edited using any code editor, in Appendix A we demonstrated how to add the PHP Development Tools (PDT) plug-in to your Flash Builder installation, so we expect you’ll use Flash Builder to create and edit PHP files. Within the PHP file, code is wrapped ...

Get Learning Flex 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.