PHP

View:  
Sorted by:  

How to Add and Change MySQL Passwords and Privileges

Passwords in MySQL aren’t set in stone. You can add or change a password for an existing account. Like many procedures, you can add or change passwords with an SQL statement, like this: [more…]

How to Handle MySQL Errors

You use the mysqli functions of the PHP language, such as mysqli_connect and mysqli_query, to interact with the MySQL database. Things will sometimes go wrong when you use the statements. You may make [more…]

How to Create and Assign Values to PHP Variables

PHP variables can hold numbers or strings of characters. You store information in variables with a single equal sign (=). For instance, the following four PHP statements assign information to variables [more…]

How to Use PHP Variable Variables

PHP allows you to use dynamic variable names, called variable variables. You can name a variable with the value stored in another variable. That is, one variable contains the name of another variable. [more…]

How to Display PHP Variable Values

You can display the value in a PHP variable on a web page by using any of the following statements: echo, print, print_r, or var_dump. [more…]

PHP Constants

PHP constants are similar to variables. Constants are given a name, and a value is stored in them. However, constants are constant; that is, they can’t be changed by the script. After you set the value [more…]

PHP Data Types

Values stored in a PHP variable or a PHP constant are stored as a specific type of data. PHP provides the following eight data types: [more…]

PHP Sessions and Cookies

You've undoubtedly seen websites that use cookies to track who you are, possibly welcoming you after you log in or presenting you with custom information about your account after logging in. You can use [more…]

Check Whether PHP Cookies Are Enabled

You use the setcookie() function in PHP to set a cookie in the browser. Then if your program can read that cookie, you know that cookies are enabled. The [more…]

How to Start a PHP Session

The key to using PHP sessions is the session_start() function. You call session_start() on every page and subsequently have access to all the items in the [more…]

How to Develop an Object-Oriented Script

Object-oriented scripts require a lot of planning. You need to plan your objects and their properties and what they can do. Your objects need to cover all their responsibilities without encroaching on [more…]

How to Write a Class Statement

You write the PHP class statement to define the properties and methods for the class. The class is the template (pattern) for the object. The class statement has the following general format: [more…]

How to Use a PHP Class in a Script

The PHP class code needs to be in the script that uses the class. Most commonly, the class is stored in a separate include file and is included in any script that uses the class. [more…]

How to Copy PHP Objects

PHP provides a method you can use to copy an object. The method is __clone, with two underscores. You can write your own __clone method in a class if you want to specify statements to run when the object [more…]

Get Information about PHP Objects and Classes

At their simplest, objects are data types. The class is the template (pattern) for the object. PHP provides several functions that you can use to get information about objects and classes: [more…]

How to Use PHP Variables for HTML5 and CSS3 Programming

A PHP variable can be named almost anything in HTML5 and CSS3 programming. There are some reserved words that you can't name a variable (like print, which already has a meaning in PHP), so if your program [more…]

How to Use PHP with HTML5 Programming

PHP is a different language than HTML5, but the two are very closely related. It may be best to think of PHP as an extension that allows you to do things you cannot do easily in HTML. [more…]

How to Use PHP to Build an HTML5 Form with Complex Elements

For an example of using PHP to build more complex HTML5 forms, look over monty.html. This program is a tribute to one of the best movies of all time. (You might just have to rent this movie if you’re really [more…]

How to Use PHP to Build a Program that Makes its Own HTML5 Form

An especially important application of the if structure is unique to PHP server-side programming. Up to now, many of your PHP programs required two separate files: an HTML page to get information from [more…]

How to Use PHP to Make a Switch for HTML5 and CSS3 Programming

Often, you run across a situation in HTML5 and CSS3 programming where you have one expression that can have many possible values. You can always use the structure to manage this situation, but PHP supplies [more…]

How to Make While Loops with PHP for HTML5 and CSS3 Programming

The while loop is the primary way, other than a for loop, of repeating code in PHP. As an HTML5 and CSS3 programmer, there may be times when you choose one over the other, but it is important to understand [more…]

How to Use One-Dimensional Arrays with PHP for HTML5 and CSS3 Programming

The most basic array in PHP is a one-dimensional array,which is basically just one container with slots for HTML5 and CSS3 programming. Each slot has only one variable in it. Here, you find out how to [more…]

How to Use PHP Loops with Arrays for HTML5 and CSS3 Programming

PHP arrays and loops are like peanut butter and jelly; they just go together. When you start to use arrays in HTML5 and CSS3 programming, eventually, you'll want to go through each element in the array [more…]

How to Break Strings into Arrays in PHP for HTML5 and CSS3 Programming

Many times, it can be useful in PHP to break a string into an array, especially when reading input from a file for HTML5 and CSS3 programming. Here are the two different ways of doing this: [more…]

How to Write Text to Files in PHP for HTML5 and CSS3 Programming

Here, you will find details about the functions needed to access and write to a file in PHP, such as how to request access to a file from PHP with the [more…]

Listings:1-2526-5051-7576-100more...

Sign Up for RSS Feeds

Computers & Software
Win $500. Easy. Enter to win now.

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.