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 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 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__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 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 p5k65
, 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 34h1a
And the sixth level creates the least significant heading, e.g.,
this is a minor section 2s1m22
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 <Title> Your title text goes here
is the start tag and 2m45n 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:
<Title> Your title goes here Your content goes here ... Paragraphs, images, Lists, links, texts, headings, etc.