php

Post on 14-Nov-2014

36.606 views 2 download

Tags:

description

 

Transcript of php

Govt. Engineering College AJMER

A training presentation on :

PHP with MySql

Submitted By : Ajeet Kr. Jhajharia 09CS04

Submitted to : Mr. Vinesh Jain

Content :

Company Profile History of php What is php ? Features of php php code look like Php Contents Advantage of php MySql

CEG : Center for Electronic Governance

CEG is an autonomous body of the Govt. of Rajasthan under the department of technical Education.Foundation stone of CEG was laid down on 8th December 2006 at Khaitan Polytechnic College Jaipur by Shri Ghanshyam Tiwari and Shri Vasudev Devnani, Hon’ble Ministers for Technical Education.

History of php :

Created by Rasmus Lerdorf in 1994 Originally a set of Perl scripts used

by Lerdorf to show off his résumé.

What is php ?

php stands for “Hypertext PreProcessor” .

An open source language . php is a server-side scripting language . php is used to generate dynamic web pages. php code can be embedded within an HTML

page.

What is php ?

‘View Source’ in browsers does not display the php code .

php supports many popular databases such as MySql , Oracle and many more.

Features of php :

Very Efficient :– Can serve millions of hits per day. Database Integration :– Supports many databases,

such as MySql and Oracle.

It’s Free :– Available on http://www.php.net Easy to Learn – Very similar in syntax to C and

C++ php uses both procedural and object oriented

paradigms.

php codes look like ?

Each PHP script must be enclosed in the reserved php tag .

<?php

?>

php Contents:

Variables Constant Operators Array Functions

Variables :Variables are used for storing values,

such as numbers, strings or function results, so that they can be used many times in a script.PHP variables must begin with a “$”

signPhp variables are case-sensitive

($Sign!= $sign != $siGn)◦Certain variable names reserved by

PHP like form variables ($_POST, $_GET), server variables ($_SERVER) etc.

Operators :Arithmetic Operators (+,-,*,/)Example:- $total=$a+$b;

Assignment Operators(=)Example:- $t=$a+$b;

Comparison Operators (<, <=, >, >=)Logical Operators (&&. ||,!)

Arrays:<?php$arr = array("somearray" => array(6 => 5, 13 => 9, "a" => 42));

echo $arr["somearray"][6]; // 5echo $arr["somearray"][13]; // 9 echo $arr["somearray"]["a"]; // 42

?>

Functions :Functions must be defined before then

can be called

Function headers are of the format

function functionName($arg1,$arg2,………$argn)

◦Note that no return type is specified

Function Example:<?php function mul($arg1, $arg2) { $arg2 = $arg1 * $arg2;

  return $arg2;}

$result = mul(12, 3); // Store the function

echo $result1; // Outputs 36?>

Advantage of php :

Open sourceProcedural / Object Oriented

programmingSupports wide range of DatabasesEasy to learnPortable

Why MySql ?

Most popular open-source DB Fast, reliable, scalable, etc. Integrated with common applications Based on SQL Standard

◦Probably at least as compliant as other DBs

MySQL Query Basics

mysql_connect() :- This function returns the connection on success, or FALSE and an error on failure. mysql_select_db() :- The mysql_select_db() function sets the active MySQL database.

MySQL Query Basics mysql_query() :- The mysql_query() function executes a query on a MySQL database. mysql_num_rows() :- The mysql_num_rows() function returns the number of rows in a recordset. mysql_fetch_array() :-The mysql_fetch_array() function returns a row from a recordset as an associative array and/or a numeric array.

Project Snapshots

Project:

Student Information System