Posts

Showing posts with the label PHP

Why PHP?

We expect our readers to have a more than firm handle on what PHP is, but for completeness-sake: PHP (a recursive acronym of PHP: Hypertext Preprocessor) is an open source, server-side web-scripting language for creating dynamic web pages. Outside of it being browser independent, it offers a simple and universal cross-platform solution for e-commerce, and complex web and database-driven applications. PHP has: A low, smooth learning curve. Broad functionality for databases, strings, network connectivity, file system support, Java, COM, XML, CORBA, WDDX, and Macromedia Flash. Platform compatibility with UNIX (all variants), Win32 (NT/95/98/2000), QNX, MacOS (WebTen), OSX, OS/2, and BeOS. Server compatibility for Apache module (UNIX, Win32), CGI/FastCGI, thttpd, fhttpd, phttpd, ISAPI (IIS, Zeus), NSAPI (Netscape iPlanet), Java servlet engines, AOLServer, and Roxen/Caudium module. A rapid development cycle. New versions with bug fixes, additional functionality, and other i...

Database Design

Designing your database properly is critical to your application performing well. Just like putting the printer all the way across your office, placing data in poor relationships makes work less efficient in that it can cause your database server to waste time looking for data. When thinking about you database, think about what kinds of questions will be asked when your database is used. For example, is this a valid username and password? Or, what are the details about a product for sale? MySQL is a relational database. An important feature of relational systems is that a single database can be spread across several tables as opposed to our flat-file phone book example. Related data is stored in separate tables and allows you to put them together by using a key common to both tables. The key is the relation between the tables. The selection of a primary key is one of the most critical decisions you'll make in designing a new database. The most important concept that...

PHP Expressions

There are several building blocks of coding in PHP that you need to understand: statements, expressions, and operators. A statement is code that performs a task. Statements themselves are made up of expressions and operators. An expression is a piece of code that evaluates to a value. A value is a number, a string of text, or a Boolean. An operator is a code element that acts on an expression in some way. For instance, a minus sign can be used to tell the computer to decrement the value of the expression after it from the expression before it. The most important thing to understand about expressions is how to combine them into compound expressions and statements using operators. So we're going to look at operators used to turn expressions into more complex expressions and statements. The simplest form of expression is a literal or a variable. A literal evaluates to itself. Some examples of literals are numbers, strings, or constants. A variable evaluates to the value ...

PHP Coding Building Blocks

To write programs in PHP that do something useful, you'll need to understand blocks of reusable code called functions or methods, and then how to temporarily store information that cannot be executed in variables. We talk about evaluations, which are basically things that allow your code to make intelligent decisions based on mathematical principles and user input. Since you haven't done any programming, we understand that variables are a new concept. A variable stores a value, such as the text string "Hello World!" or the integer value 1. A variable can then be reused throughout your code, instead of having to type out the actual value over and over again for the entire life of the variable, which can be frustrating and tedious. In PHP, you define a variable with the following form: $variable_name = value; Pay very close attention to some key elements in the form of variables. The dollar sign ($) must always fill the first space of your variable. The fi...

Installation Of PHP and MySQL

Image
Developers working with PHP and MySQL often find it convenient to work on a local computer rather than a web server. In general, it is also safer to create and test your applications on a localpreferably privatecomputer and then deploy them to a public server where others can enjoy your work. Typically, you need to install Apache, PHP, and MySQL on the local computer, while your ISP handles installation on the public server. Developing your construct on your local computer is the recommended way to learn, since you can interact with all of the components on your own machine and not risk causing problems on a production server. That way, if there are problems in the local environment, you can fix them immediately without exposing them to your site's visitors. Working with your files locally means that you don't have to FTP them to a server, you don't have to be connected to the Internet, and you know exactly what's installed since you did it yourself. There...

Components of a PHP Application

In order to process and develop dynamic web pages, you'll need to use and understand several technologies. There are three main components to creating dynamic web pages: a web server, a server-side programming language, and a database. It's a good idea to have an understanding of the three basic components for web development using PHP. Start with some rudimentary understanding of the history and purpose of Apache (your web server), PHP (your server-side programming language), and MySQL (your database). This can help you understand how they fit into the web development picture. Remember that dynamic web pages pull information from several sources simultaneously, including Apache, PHP, MySQL , and Cascading Style Sheets (CSS). PHP is ubiquitous and compatible with all major operating systems. It is also easy to learn, making it an ideal tool for web-programming beginners. Additionally, you get to take advantage of a community's effort to make web development ...

PHP and MySQL's in Web Development

PHP is a programming language designed to generate web pages interactively on the computer serving them, called a web server . Unlike HTML, where the web browser uses tags and markup to generate a page, PHP code runs between the requested page and the web server, adding to and changing the basic HTML output. For example, PHP code could be used to display a counter of visitors to a site. PHP, in less than 20 lines of code, can store the IP address from which a page request comes in a separate file, and then display the number of unique IP addresses that visited a particular site. The person requesting the web page doesn't know that PHP generated the page, because the counter text is part of the standard HTML markup language that the PHP code generated. PHP makes web development easy, because all the code you need is contained within the PHP framework. This means that there's no reason for you to reinvent the wheel each time you sit down to develop a PHP program; tha...