PHP for Absolute Beginners

PHP for Absolute Beginners

Jason Lengstorf, Thomas Blom Hansen

Language: English

Pages: 256

ISBN: 1430268158

Format: PDF / Kindle (mobi) / ePub


PHP is a server-side scripting language that enables you to develop dynamic sites that engage users in ways that are simply not possible using only HTML and CSS. PHP for Absolute Beginners takes a practical approach to teaching you how to build dynamic content for your website using PHP. You’ll quickly get started with practical PHP projects, learning how to build a dynamic image gallery. By the end of the book you’ll will have developed a personal blog complete with a password protected admin module.

PHP for Absolute Beginners won't swamp you with every detail of the full PHP language up front – instead, you’ll be introduced to a small, versatile subset of PHP and learn to use it creatively to develop dynamic web sites. In the process you will learn to use variables, control structures, functions, and objects to your advantage. You will learn how to plan and create databases and how to organize your PHP scripts beautifully. At the end of the book, you will be a confident PHP user, ready to take the next steps in creating great websites.

Responsive Web Design by Example

HTML5 in Action

REST in Practice: Hypermedia and Systems Architecture

Web Service APIs and Libraries

Getting Started with nopCommerce

 

 

 

 

 

 

 

 

 

 

 

 

 

 

backslash doesn't need to be escaped if not escaping a // special character. echo 'This string has a backslash (\) in it.
'; echo 'This string has an escaped backslash (\\) in it.
'; // Variables will not be expanded in single quotes echo 'This $variable will not be expanded.
'; ?> 33 CHAPTER 2 UNDERSTANDING PHP: LANGUAGE BASICS The output of this code in a browser looks like this: This This This This This This This is a string. is a string with line breaks. is a string \n

(PDO). Keeping Database Credentials Separate It’s a good habit to keep database credentials and other site-wide information separate from the rest of your scripts. The reason: This allows you to change an entire project’s configuration quickly and easily by altering a single file. You might wonder why skipping this step could matter. Imagine that you build a project that has dozens of scripts, all of which need to contact the database for some reason or another. Now imagine that the database is

...........................................................................................171 Creating Your .htaccess File .........................................................................................171 Step 1: Turn on URL Rewriting................................................................................171 Step 2: Declare the Base-Level Folder for Rewriting..............................................172 Step 3: Set Up a Rule to Stop Rewriting for Certain File Types

// End the foreach loop } // End the else ?>

Now, navigate to http://localhost/simple_blog/, and you should see the title of each entry listed as a link(see Figure 5-8). Clicking any of the links takes you to the associated entry. Figure 5-8. The title of each entry is listed as a link 154 CHAPTER 5 BUILDING THE ENTRY MANAGER Fix the Redirect Now that index.php exists, you want to be taken to your new entries after

.............................................................................311 Adding Administrators in the Database...............................................................................312 Building an HTML Form ................................................................................................312 Saving New Administrators in the Database ................................................................315 Dealing with Passwords

Download sample

Download