Register your product to gain access to bonus material or receive a coupon.
Create Dynamic Webpages with PHP and MySQL
David Tansley
Do you want to learn the essentials of PHP in an easy manner with the help of expert
guidance and a wealth of practical examples? Would you like to be able to create dynamic
web pages and learn how to interact with MySQL database even though you may have
little or no experience? Then this book is for you.
You donß´ need prior knowledge of programming as this book will provide you with
everything you need to know about PHP, MySQL and how to create dynamic webpages.
You learn by example from the many practical examples throughout the book. You will
taught how to create simple web pages first and then gradually build up to using forms.
PHP is the scripting language of choice for Linux server ß even if you havenß´ got a
web server installed, donß´ worry. The first chapter of this book covers what to install
and configure in an easy to understand way. And all the software you need is on the accompanying CD-Rom which includes apache, Netscape, PHP, and MySQL source code.
Plus, all the scripts from the book.
Skills you will learn
David Tansley has many years' experience in UNIX, and Linux, as a systems administrator on a variety of platforms, and is currently a Senior Systems and Database Administrator at Ace Global Markets, a Lloyds of London Underwriting Agency. He is the author of Linux and Unix Shell Programming also published
By Addison Wesley.
CONTENTS
Part One
Introduction
Installing PHP and MySQL
Just the PHP Basics Please
Let's Go! With examples
Using Files
E-Mail
Cookies
Part Two
What are RDBMS Databases
A Basic Web Based Database Update Application
Creating a 'gotcha' database Application
Appendix
In the last few years we have seen the rise and rise of Linux. Though this book is not about Linux per se it is important to understand that if it were not for the popularity of Linux, both in the commercial and domestic worlds, we would not have had the explosion of activity of people like you and me creating fantastic web sites, advertising who we are, our interests and what we do. Why is this so? Because Linux, no matter what variant you have (Susie, RedHat), is free and is open source.
The reason why most people use Linux is for the Web server Apache. You can use other web servers if you prefer, but why should you when it is a great product!
Once you have Apache up and running, the first thing you want to do is create web pages, be it for your own personal use or putting it on the world wide web. Creating web pages requires at least a grasp of HTML tags. You may prefer to use the many shareware products available to create your web pages but it doesn't matter what method you use as long as you are pleased with the end result.
Now the world wide web and Linux have been around for some time. Users now want to create better web sites, not necessary better in the way of graphics but make them dynamic. What does dynamic mean? Being able to respond to a request from a browser, for example, or someone mailing you from your web page, or letting users enter information in your guest books, or holding information on your web server which can be queried -- the list is pretty much endless. To be able to create these types of dynamic web pages, you need a programming language that can create and process these web pages. There are many on the market but some of them have an initial steep learning curve, in other words the language is hard to learn if you are new to programming. All that has changed now because there is a new web programming language called PHP (Hypertext Processor). This language was created specifically for the web, though it can be used for other purposes, to allow users like you and me to create good dynamic web pages, and it's easy to learn.
ABOUT THIS BOOKThe aim of this book is to get you up and running using PHP in a quick and easy manner. The full language of PHP is huge but we will not cover all the different tasks you can do with PHP, just the basics. We shall take it one step at a time, gradually building up to put you in a position to understand the concepts of the language and how it handles web processing. Along the way I will explain what we are doing using examples. Here is a list of some of the areas I will cover:
This book will not preach to you the complete language syntax theory, or the internals of the language. I will leave that for you to explore in other books. What this book will teach is how to use the language in simple terms to create really dynamic web pages. We will create simple web pages first and then gradually build up to using forms. We will then move on to how you can interact with databases, notably mySQL, the preferred database of Linux (that's my view only).
WHAT YOU NEED TO KNOWThe book is aimed mostly at the Linux market, purely because this is where the bulk of the PHP base is. If you want to run PHP on Windows, you can, and the examples I use in this book are relevant to Windows and Linux users. To get the most out of this book you need to know:
Why make the above statement? Well, I will teach you all you need to know as we go along with examples, example and more examples. In fact this book contains mainly working examples with no long boring paragraphs -- after all, you wanted to buy a book tha/ teaches you PHP in a practical and easy way.
When creating scripts in PHP, you will benefit from a little knowledge of HTML, but I will explain the HTML tags as we go along. This book is intended for the absolute beginner who wants to write PHP scripts, but others who have used PHP in a casual manner will also find this book helpful.
For PHP to work you will require a web server to enable PHP to run as a web server side script, a database to store your information, and, of course, a browser to view your executed PHP scripts. All the above are supplied on the CD accompanying this book. They are:
The book covers PHP Version 4.
THE STRUCTURE OF THE BOOKIn Part 1 we will go through what I consider to be the basics of PHP. This includes the following, amongst others:
In Part 2 we will start dealing with forms, this is what dynamic web pages are all about. Topics covered are:
In Part 3 I introduce you to mySQL, the database server. After some examples of how to insert and get information out of the server, we turn to PHP to see how we can connect to mySQL and produce some really dynamic pages with a database as the back-end. The topics covered are:
In Part 4 we look at how you secure Apache using authentication, and at securing individual files as well as directories. We also look at how to integrate PHP with Apache authentication, making your authentication process seamless. The topics covered are: