20120425

Which databases supported by PHP?


PHP Data Objects (PDO) was introduced back with the 5.1 release of PHP.

PDO creates a consistent, abstracted interface to database servers and data.
PHP offers several database-specific drivers for both PDO and non-PDO access.
The PHP web site contains a list with the latest information about databases that can be integrated along with the PDO abstraction layer and other abstraction layers.

HERE WE ARE FOCUSING ONLY "MYSQL" DATABASE.

Reference: www.php.net/pdo for more info.....

Why a Database?


If you’re developing a PHP application using content / data, you’re likely to need a database. Even for  something small, like a personal blog, you want to think hard about the advantages of using a database instead of static pages or included text files.

Maintainability and scalability

Having PHP assemble your pages on the fly from a template and a database is an addictive experience. Once you enjoy it, you’ll never go back to managing a static HTML site of any size. For the effort of programming one page, you can produce an infinite number of uniform pages. Change one, and you’ve changed them all.

There are now web sites with hundreds of thousands of separate pages — you can rest assured that no one is maintaining them all by hand. If you have a web site that may eventually grow to more than a few dozen pages, you should think about moving to a database sooner rather than later.

Portability

Because a database is an application rather than a part of the operating system, you can easily transfer its structure and contents from one machine to another or (in certain cases) even from one platform to another. This is especially valuable for contractors, who may develop a project without being able to control the environment in which it will eventually be deployed — they can deliver a package of PHP plus a MySQL database schema dump.

Avoiding awkward programming

Certain things can be done with PHP but probably shouldn’t, because they entail ugly or risky programming moves. Say that you happen to be the commander of the "Airbus 787"  and are keeping a captain’s log. Each log entry is contained in a text file identified by its unique stardate, which is plugged into a template by PHP — but hey, you’re a busy spaceman with whole galaxies to explore; you don’t always have time to write in your log every day. You want to put automatically generated Next and Previous links on each page for those who wish to read in straight chronological order. It’s pretty easy to use PHP to find the previous stardated entry, but any attempt to locate the next entry can quickly become an infinite loop — because it’s easier to prove something does exist than that it doesn’t. On the other hand, if you put your log data in a database, the whole job becomes trivial.

The database will tell you which is the latest entry at any given moment. There are other types of programming tasks that a database is highly optimized to do, and given the option, you should take advantage of it to perform these chores. For instance, you should avoid sorting data sets on the PHP side in favor of writing queries so the data is returned presorted. Searching Although it’s possible to search multiple text files for strings (especially on Unix platforms), it’s not something most web developers will want to do often. After you search a few hundred files, the task becomes slow and hard to manage.

In some cases, information attains value only when put into a searchable database. For instance, relatively few people would want to read a long text list of movie directors and their films, but many might occasionally want to search a database of that information. You could argue that it’s the searchability, as much as the information itself, that creates the value here.

What Is a Database?


A database is a collection of data. The term database usually indicates that the collection of data is stored on a computer.  Database applications are useful to manage the data stored in the computer. The database applications are useful to, how the actual data is stored and retrieved. Some database applications are MySQL, MSSQL and oracle.

College databases is stored and mainated in a server called database server. A database server is a database application built with multiple users in mind. Most of the time when programming PHP you’ll be accessing a database server. Some database servers include PostgreSQL, MySQL, Microsoft’s SQL Server, and the Oracle suite of databases. Some database servers called RDBMS, which is an acronym for relational database management system.
Database servers usually have one or more distinct APIs for programmatically creating, accessing, managing, searching, and replicating the data they hold. It is through the API that you connect to and work with data stored in database servers when using PHP.

There is no requirement that an RDBMS be used to store data. Other data stores can be used such as a flat file or a table known as a hash table. These are perfectly fine for some applications, especially smaller applications; however, for larger applications or applications that require optimal speed for large data stores, an RDBMS is a requirement.

20120423

Client Side Scripting Language


Client-side scripting generally refers to the class of computer programs on the web that are executed client-side, by the user's web browser, instead of server-side (on the web server). This type of computer programming is an important part of the Dynamic HTML (DHTML) concept, enabling web pages to be scripted; that is, to have different and changing content depending on user input, environmental conditions (such as the time of day), or other variables.

Client-side scripts are often embedded within an HTML or XHTML document (known as an "embedded script"), but they may also be contained in a separate file, which is referenced by the document/s that use it (known as an "external script"). Upon request, the necessary files are sent to the user's computer by the web server (or servers) on which they reside. The user's web browser executes the script, then displays the document, including any visible output from the script. Client-side scripts may also contain instructions for the browser to follow in response to certain user actions, (e.g., clicking a mouse button). Often, these instructions can be followed without further communication with the server.

By viewing the file that contains the script, users may be able to see its source code. Many web authors learn how to write client-side scripts partly by examining the source code for other authors' scripts.

In contrast, server-side scripts, written in languages such as Perl, PHP, ASP.NET, Java, and server-side VBScript, are executed by the web server when the user requests a document. They produce output in a format understandable by web browsers (usually HTML), which is then sent to the user's computer. The user cannot see the script's source code (unless the author publishes the code separately), and may not even be aware that a script was executed. Documents produced by server-side scripts may, in turn, contain client-side scripts.

Client-side scripts have greater access to the information and functions available on the user's browser, whereas server-side scripts have greater access to the information and functions available on the server. Server-side scripts require that their language's interpreter be installed on the server, and produce the same output regardless of the client's browser, operating system, or other system details. Client-side scripts do not require additional software on the server (making them popular with authors who lack administrative access to their servers); however, they do require that the user's web browser understands the scripting language in which they are written. It is therefore impractical for an author to write scripts in a language that is not supported by popular web browsers.

Due to security restrictions, client-side scripts may not be allowed to access the user's computer beyond the web browser application. Techniques like ActiveX controls can be used to sidestep this restriction.

Client-side scripting is not inherently unsafe. Users are encouraged to always keep their web browsers up-to-date to avoid exposing their computer and data to vulnerabilities that are discovered.

The latest group of web browsers and web pages tend to employ a heavy amount of client-side scripting, accounting for an improved user interface in which the user does not experience the unfriendly "refreshing" of the web page, but instead sees perhaps an animated GIF file indicating that the request occurred and the page will be updated shortly. Ajax is an important addition to the JavaScript language, allowing web developers to communicate with the web server in the background without requiring a completely new version of the page to requested and rendered. This leads to a much improved user experience in general.

Unfortunately, even languages that are supported by a wide variety of browsers may not be implemented in precisely the same way across all browsers and operating systems. Authors are well-advised to review the behavior of their client-side scripts on a variety of platforms before they put them into use.

Server-Side Scripting Language - PHP

Server-side scripting is invisible to the user. Pity the poor server-side scripters, toiling away in utter obscurity, trapped in the no-man’s land between the web server and the database while their arty brethren brazenly flash their wares before the public gaze.

Server-side web scripting is mostly about connecting web sites to backend servers, processing data and controlling the behavior of higher layers such as HTML and CSS. This enables the following types of two-way communication:

  • Server to client: Web pages can be assembled from backend-server output.
  • Client to server: Customer-entered information can be acted upon.

Server-side scripting products consist of two main parts: the scripting language and the scripting engine (which may or may not be built into the web server). The engine parses and interprets pages written in the language.

Common examples of client-to-server interaction are online forms with some drop-down lists (usually the ones that require you to click a button) that the script assembles dynamically on the server.

Advantages of PHP, Apache, Mysql

Cross-platform compatibility

PHP and MySQL run native on every popular flavor of Linux/Unix ( Mac OS X) and Microsoft Windows. Most of the world’s Hypertext Transfer Protocol (HTTP) servers run on one of these two classes of operating systems.

PHP is compatible with the leading web servers: Apache HTTP Server for Linux/Unix and Windows
and Microsoft IIS Server (Internet Information Server). It also works with several simple, known servers.

Stability

The word stable means two different things in this context:
  • The server doesn’t need to be rebooted or restarted often.
  • The software doesn’t change radically and incompatibly from release to release.

To our advantage, both of these points apply to both MySQL and PHP.

Apache Server is generally considered the most stable of major web servers, with a reputation for enviable uptime percentages. Most often, a server reboot isn’t required for each setting change. PHP inherits this reliability; plus, its own implementation is solid yet lightweight.

PHP and MySQL are also both stable in the sense of feature stability. Their respective development teams are enjoyed a clear vision of their projects and user demand that comes along. Much of the effort goes into incremental performance improvements, communicating with more major databases, or adding better OOP support. In the case of MySQL, the addition of reasonable and expected new features has hit a rapid clip. For both PHP and MySQL, such improvements have rarely come at the expense of compatibility.

Many extensions

PHP makes it easy to communicate with other programs and protocols. The PHP development team
seems committed to providing maximum flexibility to the largest number of users. Database connectivity is especially strong, with native-driver support for about 15 of the most popular databases plus Open DataBase Connectivity (ODBC). In addition, PHP supports a large number of major protocols such as POP3, IMAP, and LDAP. Earlier versions of PHP added support for Java and distributed object architectures (Component Object Model [COM] and Common Object Request Broker Architecture [CORBA]), making n-tier development a possibility for the first time, fully incorporated GD graphics library and revamped Extensible Markup Language (XML) support with DOM and simpleXML.

Fast feature development

Users of proprietary web development technologies can sometimes be frustrated by the glacial speed at which new features are added to the official product standard to support emerging technologies. With PHP, this is not a problem. All it takes is one developer, a C compiler, and a dream to add important new functionality. This is not to say that the PHP team will accept every random contribution into the official distribution without community buy-in, but independent developers can and do distribute their own extensions that may later be folded into the main PHP package in more or less unitary form. For instance, Dan Libby’s elegant xmlrpc-epi extension was adopted as part of the PHP distribution in version 4.1, a few months after it was first released as an independent package.

PHP development is also constant and ongoing. Although there are clearly major inflection points, such as the transition between PHP4 and PHP5, these tend to be most important deep in the guts of the parser — people were actually working on major extensions throughout the transition period without critical problems. Furthermore, the PHP group subscribes to the open source philosophy of “release early, release often,” which gives developers many opportunities to follow along with changes and report bugs.

Not proprietary

The history of the personal computer industry to date has largely been a chronicle of proprietary standards: attempts to establish them, clashes between them, their benefits and drawbacks for the consumer, and how they are eventually replaced with new standards. In the past few years the Internet has demonstrated the great convenience of voluntary, standardsbased, platform-independent compatibility. E-mail, for example, works so well because it enjoys a clear, firm standard to which every program on every platform must conform. New developments that break with the standard (for example, HTML-based e-mail stationery) are generally regarded as deviations, and their users find themselves having to bear the burdens of early adoption. Furthermore, customers (especially the big-fish businesses with large systems) are fed up with spending vast sums to conform to a proprietary standard only to have the market uptake not turn out as promised. Much of the current momentum toward XML and web services is driven by years of customer disappointment with Java RMI (Remote Method Invocation), CORBA, COM, and even older proprietary methods and data formats. Right now, software developers are in a period of experimentation and flux concerning proprietary versus open standards. Companies want to be sure that they can maintain profitability while adopting open standards. There have been some major legal conflicts related to proprietary standards, which are still being resolved. These could eventually result in mandated changes to the codebase itself or even affect the futures of the companies involved. In the face of all this uncertainty, a growing number of businesses are attracted to solutions that they know will not have these problems in the foreseeable future. PHP is in a position of maximum flexibility because it is, so to speak, antiproprietary. It is not tied to any one server operating system, unlike Active Server Pages. It is not tied to any proprietary cross-platform standard or middleware, as is Java Server Pages or ColdFusion. It is not tied to any one browser or implementation of a programming language or database. PHP isn’t even doctrinaire about working only with other open source software. This independent but cooperative pragmatism should help PHP ride out the stormy seas that seem to lie ahead. Strong user communities PHP is developed and supported in a collaborative fashion by a worldwide community of users.

Some core developers are more equal than others, but that’s hard to argue with, because they put in the most work, had the best ideas, and have managed to maintain civil relationships with the greatest number of other users. The main advantage for most new users is technical support without charge, without boundaries, and without the runaround. People on the mailing list are available 24/7/52 to answer your questions, help debug your code, and listen to your gripes. The support is human and real. PHP community members might tell you to read the manual, take your question over to the appropriate database mailing list, or just stop your whining — but they’ll never tell you to wipe your C drive and then
charge you for the privilege. Often, they’ll look at your code and tell you what you’re doing wrong or even help you design an application from the ground up.

As you become more comfortable with PHP, you may wish to contribute. Bug tracking, offering
advice to others on the mailing lists, posting scripts to public repositories, editing documentation, and, of course, writing C code are all ways you can give back to the community. MySQL, while open source licensed for non-redistributive uses, is somewhat less community driven in terms of its development. Nevertheless, it benefits from a growing community of users who are actively listened to by the development team. Rarely has a software project responded so vigorously to community demand, and the community of users can be extremely responsive to other users who need help. It’s a point of pride with a lot of SQL gurus that they can write the complicated queries that get you the results you are looking for but had struggled with for days. In many cases, they’ll help you for nothing more than the enduring, if small, fame that comes with the archived presence of their name on Google Groups.

Embedding PHP into the HTML

PHP can write with HTML combination. We can integrate PHP within HTML.

When a user requests this page, the web server preprocesses it, the page process from top to bottom, looking for sections of PHP, the php code will try to resolve, and finally the page provides the result as HTML format.

HTML and PHP Example:



When a user requests this page, the web server preprocesses it, the page process from top to bottom, looking for sections of PHP, the php code will try to resolve, and finally the page provides the result as HTML format.

Here is the "Browser" HTML Code::


This code is exactly the same as if you were to write the HTML by hand!

The HTML-embeddedness of PHP has many helpful to add dynamical code.

  • PHP can quickly be added to code produced by WYSIWYG editors.
  • Every line of HTML does not need to be rewritten in a programming language.
  • PHP can reduce man power costs and increase efficiency, because of its easy learning curve and ease of use.

20120417

Which Platform is Better for Web Development?


There are many platforms available for web applications development. This section compares PHP to a few other platforms and highlights some of PHP’s and MySQL’s strengths.

Cost

PHP is one of the “P’s” in the popular LAMP stack. The LAMP stack refers to the popular combination of Linux, Apache, MySQL, and PHP/Perl/Python that runs many web sites /applications and powers many small & large web applications. Many of the components of the LAMP stack are free / Open Source. PHP is free, as in there is no cost to develop in and run programs made with PHP language. Though MySQL’s license and costs have changed, you can obtain the Community Server edition for free. MySQL offers several levels of support contracts for their database server. Both PHP and MySQL run on a variety of platforms, including many variants of Linux, Microsoft Windows, and others. Running on an operating system such as Linux gives the opportunity for a completely free web application platform, with no up-front costs.

Of course, when talking about software development and application platforms, the up-front cost of  software licensing is only a portion of the total cost of ownership. Years of real-world experience with Linux, Apache, MySQL, and PHP in production environments has proved that the total cost of maintaining these platforms is lower, many times much lower, than maintaining an infrastructure with proprietary, non-free software.

Ease of Use

When compared to many other programming languages, PHP makes it easy to develop powerful web applications quickly. Many of the most useful specific functions (such as those for opening a connection to an Oracle database or fetching e‑mail from an Internet Message Access Protocol [IMAP] server) are predefined for you. A lot of complete scripts are waiting out there for you to look at as you’re learning PHP.

Most advanced PHP users (including most of the development team members) are diehard handcoders.They tend to share certain gut-level, subcultural assumptions — for instance, that handwritten code is beautiful and clean and maximally browser-compatible and therefore the only way
to go — that they do not hesitate to express in vigorous terms. The PHP community offers help and trades tips mostly by e‑mail, and if you want to participate, you have to be able to parse plain-text source code with facility.  PHP really is easy to learn and write, especially for those with a little
bit of experience in a C-syntaxed programming language. It’s just a little more involved than HTML. This small learning curve means that relatively inexperienced programmers can sometimes make mistakes that turn into large security issues.

If you have no relational database experience, or are coming from an environment such as Microsoft Access, MySQL’s command-line interface and lack of implicit structure may at first seem a little daunting. MySQL has a few GUI (graphical user interface) tools to help work with databases.

What Is MySQL?


MySQL (pronounced My Ess Q El) is an open source, SQL relational database management system (RDBMS) that is free. Early in its history, MySQL occasionally faced opposition because of its lack of support for some core SQL constructs such as subselects and foreign keys. Ultimately, however, MySQL found a broad, enthusiastic user base for its liberal licensing terms, perky performance, and ease of use. Its acceptance was aided in part by the wide variety of other technologies such as PHP, Perl, Python, and the like that have encouraged its use through stable, well-documented modules and extensions.

Databases are generally useful, perhaps the most consistently useful family of software products (the “killer product”) in modern computing. Like many competing products, both free and commercial, MySQL isn’t a database until you give it some structure and form. You might think of this as the difference between a database and an RDBMS i.e., RDBMS plus user requirements equal a database.

20120416

What Is PHP?


PHP is the web development language written by and for web developers.


PHP stands for PHP: Hypertext Preprocessor. The product was originally named Personal Home Page Tools, and many people still think that’s what the acronym stands for, but as it expanded in scope, a new and more appropriate (albeit GNU-ishly recursive) name was selected by community vote.


PHP is currently in its sixth major rewrite, called PHP6 or just plain PHP. PHP is a server-side scripting language, usually used to create web applications in combination with a web server, such as Apache. PHP can also be used to create command-line scripts akin to Perl or shell scripts, but such use is much less common than PHP’s use as a web language. 

Strictly speaking, PHP has nothing to do with layout, events, on-the-fly Document Object Model (DOM) manipulation, or really anything about the look and feel of a web page. In fact, most of what PHP does is invisible to the end user. Someone looking at a PHP page will not necessarily be able to tell that it was not written purely in Hypertext Markup Language (HTML), because the result of PHP is usually HTML.




PHP - MySQL Tutorials


PHP and Mysql are Open source technologies.


PHP is the most popular scripting language to develop web application. Millions of the sites are developed in PHP Language.  For developing web applications MySQL is utilized with PHP Scripting Lanugage.


This tutorials is collection of different resources:


PHP Documentation :: The PHP Documentation is available at online, The manual is located at www.php.net and served up by PHP. 


The PHP Manual is a great resource to improve knowledge / learning  for developing the web applications.


This tutorial is not that manual or even a substitute for it. I am providing a complementary to the manual and expect that you will want to improve your knowledge easily.


In general, you’ll find the online manual to be very comprehensive, covering all aspects and functions
of the language.


In this tutorials, you will get short explanation and real - time examples to develop or implement a functionality.

We will reach the goal by step by step.....