Php Training Report
Short Description
A report on php programming language...
Description
A REPORT ON
PHP&MYSQL ELPIS TECNOLOGIES Submitted to Department of Computer Science & Engineering In partial fulfilment of the requirements For the degree of BACHELOR OF TECHNOLOGY IN COMPUTER SCIENCE By VIKAS YADAV Roll No.0924010126 Under the guidance of Mrs Payal Kansal
Sunderdeep Engineering College
DECLARATION We hereby declare that this submission is our own work and that, to the best of our knowledge and belief, it contains no material previously published or written by another neither person nor material which to a substantial extent has been accepted for the award of any other degree or diploma of the university or other institute of higher learning, except where due acknowledgment has been made in the next.
Name : Vikas Yadav Roll No.: 092410126 Date : 11/11/13
3
ACKNOWLEDGEMENT I take this opportunity to bestow, form my heart, my deep sense of gratitude and indebtedness to my Mrs. Payal Kansal for her valuable and continuous encouragement. I am grateful to her for her tireless and consistent supervision and help she rendered to me throughout the course of my experimentation and subsequently in my preparation of this dissertation. I am thankful to DEV SIR CEO of ELPIS TECNOLOGIES. , for their unconditional and most willing support during preparation of the project report. VIKAS YADAV SDEC GHAZIABAD
4
ABOUT THE TRAINING During Industrial Training at ELPIS TECNOLOGIES NOIDA, I studied about Php & Mysql and its basics.
5
TABLE OF CONTENTS Chapter Title
Page no.
Certificate Copy of training certificate Declaration Acknowledgement About Training Table of Contents Abstract
1 2 3 4 5 6 7
1.INTRODUCTION
8
Some Basics Operators Syntax Arrays Functions
9
10
2.HTML
12
Heading Title Paragraph
13
3.MYSQL
14
Data base Sql and/or operators RDBMS
4. Inroduction to PHP 5. Conclusion 6. Refrence
15 17 18
6
Abstract
PHP 5 introduces abstract classes and methods. Classes defined as abstract may not be instantiated, and any class that contains at least one abstract method must also be abstract. Methods defined as abstract simply declare the method's signature - they cannot define the implementation. When inheriting from an abstract class, all methods marked abstract in the parent's class declaration must be defined by the child; additionally, these methods must be defined with the same (or a less restricted) visibility. For example, if the abstract method is defined as protected, the function implementation must be defined as either protected or public, but not private. Furthermore the signatures of the methods must match, i.e. the type hints and the number of required arguments must be the same. For example, if the child class defines an optional argument, where the abstract method's signature does not, there is no conflict in the signature. This also applies to constructors as of PHP 5.4. Before 5.4 constructor signatures could differ. That’s the theory for defining a regular class in PHP, so let’s go one step further and ask ourselves: what’s an abstract class? In the simplest sense, an abstract class is a class that cannot (and should not) be instantiated. This may sound a little illogical for beginning programmers, but there are situations where this concept makes a lot of sense. Anyone who has spent considerable time using the object model provided by PHP 4 knows what a class is, but just in case you’ve forgotten this concept, let’s go over the basics quickly. In PHP a class is merely a set of statements that perform a specific task, and its definition contains both properties and methods, which act as the blueprint from which to create –- or instantiate -– independent objects.
7
CHAPTER-1 Introduction
PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. PHP is now installed on more than 244 million websites and 2.1 million web servers. Originally created by Rasmus Lerdorf in 1995, the reference implementation of PHP is now produced by The PHP Group. While PHP originally stood for Personal Home Page, it now stands for PHP: Hypertext Preprocessor, a recursive acronym. PHP code is interpreted by a web server with a PHP processor module, which generates the resulting web page: PHP commands can be embedded directly into an HTML source document rather than calling an external file to process data. It has also evolved
to
include
a command-line
interface
capability
and
can
be
used
in standalone graphical applications. PHP is free software released under the PHP License, which is incompatible with the GNU General Public License (GPL) due to restrictions on the usage of the term PHP. PHP can be deployed on most web servers and also as a standalone shell on almost every operating system and platform, free of charge. PHP is an acronym for "PHP Hypertext Pre-processor” PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP costs nothing, it is free to download and use
8
Some Basics: PHP is a scripting language – it gets interpreted instead of being compiled like C++ and Java. Unlike JavaScript which is executed by the web browser, all PHP code is executed on the web server. The syntax is very similar to Perl and C. Variables are case sensitive, function names are not, and statements must be terminated with a semicolon. PHP code should be placed between or tags. The second method is preferred so your scripts are XML compatible. There is no limitation as to where PHP code can be inserted. To see information about how PHP is configured, version information, and the settings of all environment variables (e.g., HTTP_USER_AGENT and QUERY_STRING), call the phpinfo () function in any script. The php.ini file is the main configuration file for PHP. It can be edited by the system administrator to change any of the configuration settings. A change to this file requires the web server be restarted since the file is only read once when the web server starts up. (The phpinfo() function reports the location of
Operators: A. Assignment 1. = += -= /= *= %= ++ -- - like most programming languages. 2. .= - string concatenation operator (see strings section). B. Arithmetic 1. + - * / % - like most programming languages. C. Comparison 1. == != < > = - like most programming languages. Also is the same as !=. 2. === - true if arguments are equal and the same data type. 3. !== - true if arguments are not equal or they are not of the same data type. D. Logical 1. && || ! - like most programming languages (&& and || short-circuit) 2. and or - like && and || but have lower precedence than && and ||. 3. xor - true if either (but not both) of its arguments are true.
Syntax: A
PHP script can be placed anywhere in the document.
A PHP script starts with : 9
Arrays: A. Summary of all array functions in the PHP core: B. Arrays can have any size and contain any type of value. No danger of going beyond array bounds. $my array [0] = 25; $my array [1] = "Bisons"; C. PHP arrays are associative arrays which allow element values to be stored in relation to a key value Rather than a strict linear index order. $capitals ["CO"] = "Denver"; $capitals ["AR"] = "Little Rock"; 6 D. Initialize an array: $colors = array ("red", "green", "blue"); Print ("The 2nd color is $colors[1]."); // prints green $capitals = array ("CO" => "Denver", "AR" => "Little Rock"); Print ("$capitals [CO]"); // prints Denver, no quotes around key i
Functions: A. Functions may be declared anywhere in the source code (i.e., they do not need to be defined before they are called as C++ requires). B. Function names are case-insensitive, though it is usually good form to call functions as they appear in their C. Defining and calling 10
1. General form: Function func_name ($param_1, $param_2, ..., $param_n) { // code Return $retval; // optional: can return a scalar or an array } 2. Call: $result = func_name ($arg1, $arg2, ..., $argn);
11
CHAPTER-2 Html: HTML (Hyper Text Mark up Language) is a language for specifying how text and graphics appear on a web page When you visit a web site (e.g., www.google.com)your web browser retrieves the HTML web page and renders it The HTML page is actually stored on the computer that is hosting the web site and the page is sent to your browser To see what HTML looks like go to your web browser View menu and select View Source. HTML is written in the form of HTML elements consisting of tags enclosed in angle brackets (like ), within the web page content. HTML tags most commonly come in pairs like and , although some tags represent empty elements and so are unpaired, for example . The first tag in a pair is the start tag, and the second tag is the end tag (they are also called opening tags and closing tags). In between these tags web designers can add text, further tags, comments and other types of text-based content.
Headings: HTML allows you to create sections in a document using Headings, there are six levels of headings The first level creates the most significant heading, e.g., this is a major section And the sixth level creates the least significant heading, e.g., this is a minor section after each heading you insert the text and images that Pertain to that section, like you would do in MS Word
Title: A title is usually displayed on the top bar of a web browser’s window when you visit a web 12
Site The title will now be displayed in the main web browser window, just on the top bar Your title text goes here is the start tag and is the end tag
Paragraph: The tag is used to start a paragraph the tag is used to end a paragraph the text in between the two tags is your paragraph ... the tag is optional, HTML assumes that You are in the same paragraph until it encounters the next tag you can force a line break using the tag
Body:
Your title goes here Your content goes here ... Paragraphs, images, Lists, links, texts, headings, etc.
13
CHAPTER-3 Mysql:
MySQL is a fast, easy-to-use RDBMS being used for many small and big businesses. MySQL is developed, marketed, and supported by MySQL AB, which is a Swedish company. MySQL is becoming so popular because of many good reasons: MySQL is the most popular Open Source Relational SQL database management system. MySQL is one of the best RDBMS being used for developing web-based software applications.
Data base: A database is a separate application that stores a collection of data. Each database has one or more distinct APIs for creating, accessing, managing, searching and replicating the data it holds. Other kinds of data stores can be used, such as files on the file system or large hash tables in memory but data fetching and writing would not be so fast and easy with those types of systems.
Sql and &or operators: The AND operator displays a record if both the first condition AND the second condition are true. The OR operator displays a record if either the first condition OR the second condition is true.
Rdbms: RDBMS stands for Relational Database Management System. RDBMS is the basis for SQL, and for all modern database systems such as MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access. The data in RDBMS is stored in database objects called tables. A table is a collection of related data entries and it consists of columns and rows.
14
CHEPTER-4 Introduction to PHP What You Should Already Know Before you continue you should have a basic understanding of the following:
HTML CSS JavaScript
If you want to study these subjects first, find the tutorials on our Home page.
What is PHP?
PHP PHP PHP PHP
is an acronym for "PHP Hypertext Preprocessor" is a widely-used, open source scripting language scripts are executed on the server costs nothing, it is free to download and use
What is a PHP File?
PHP files can contain text, HTML, CSS, JavaScript, and PHP code PHP code are executed on the server, and the result is returned to the browser as plain HTML PHP files have extension ".php"
What Can PHP Do?
PHP PHP PHP PHP PHP PHP PHP
can can can can can can can
generate dynamic page content create, open, read, write, and close files on the server collect form data send and receive cookies add, delete, modify data in your database restrict users to access some pages on your website encrypt data
With PHP you are not limited to output HTML. You can output images, PDF files, and even Flash movies. You can also output any text, such as XHTML and XML. 15
Why PHP?
PHP PHP PHP PHP PHP
runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.) is compatible with almost all servers used today (Apache, IIS, etc.) supports a wide range of databases is free. Download it from the official PHP resource: www.php.net is easy to learn and runs efficiently on the server side
16
CHEPTER-5 Conclusion: PHP is a great tool for writing dynamic web pages. Non-technical users can easily learn a few handy tricks to make their web pages easier to manage, and more useful. Because its syntax resembles most C-like languages, any Computer Science student is able to learn it very quickly. When creating a PHP enhanced pages, there are a few things we must remember.PHP is a server side technology, and does not work in a browser. The filename must have .php extension.PHP enhanced pages can contain a mixture of HTML and PHP code.PHP code must be enclosed in tag. For more PHP information and tips, please visit php.net, or do a web search. You'll find tons of PHP-related material. Happy coding! Do you want your Perl code on one server to call your PHP functions on another? "Impossible!" you say? Not with XML-RPC. XML-RPC is a standard way for any application to make requests and receive responses from methods write
17
CHAPTER 6 Reference:
www.php.net Wikipedia http://www.w3schools.com/ http://patrickhurley.wordpress.com/mysql-for-oracle-dba
18
View more...
Comments