php

24
Govt. Engineering College AJMER A training presentation on : PHP with MySql Submitted By : Ajeet Kr. Jhajharia 09CS04 Submitted to : Mr. Vinesh Jain

Upload: ajeetjhajharia

Post on 14-Nov-2014

36.606 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: php

Govt. Engineering College AJMER

A training presentation on :

PHP with MySql

Submitted By : Ajeet Kr. Jhajharia 09CS04

Submitted to : Mr. Vinesh Jain

Page 2: php

Content :

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

Page 3: php

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.

Page 4: php

History of php :

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

by Lerdorf to show off his résumé.

Page 5: php

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.

Page 6: php

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.

Page 7: php

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.

Page 8: php

php codes look like ?

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

<?php

?>

Page 9: php

php Contents:

Variables Constant Operators Array Functions

Page 10: php

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.

Page 11: php

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

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

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

Page 12: php

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

?>

Page 13: php

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

Page 14: php

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

  return $arg2;}

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

echo $result1; // Outputs 36?>

Page 15: php

Advantage of php :

Open sourceProcedural / Object Oriented

programmingSupports wide range of DatabasesEasy to learnPortable

Page 16: php

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

Page 17: php

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.

Page 18: php

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.

Page 19: php

Project Snapshots

Project:

Student Information System

Page 20: php
Page 21: php
Page 22: php
Page 23: php
Page 24: php