1. Govt. Engineering College
AJMER
A training presentation on :
PHP with MySql
Submitted to : Submitted By :
Mr. Vinesh Jain Ajeet Kr. Jhajharia
09CS04
2. Content :
Company Profile
History of php
What is php ?
Features of php
php code look like
Php Contents
Advantage of php
MySql
3. 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.
4. History of php :
Created by Rasmus Lerdorf in 1994
Originally a set of Perl scripts used by
Lerdorf to show off his résumé.
5. 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.
6. What is php ?
„ViewSource‟ in browsers does not
display the php code .
phpsupports many popular databases
such as MySql , Oracle and many
more.
7. 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.
8. php codes look like ?
Each PHP script must be enclosed in the
reserved php tag .
<?php
…
?>
10. 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 “$” sign
Php variables are case-sensitive ($Sign!=
$sign != $siGn)
◦ Certain variable names reserved by PHP
like form variables
($_POST, $_GET), server variables
13. 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
14. Function Example:
<?php
function mul($arg1, $arg2)
{
$arg2 = $arg1 * $arg2;
return $arg2;
}
$result = mul(12, 3); // Store the
function
echo $result1; // Outputs 36
?>
15. Advantage of php :
Open source
Procedural / Object Oriented
programming
Supports wide range of Databases
Easy to learn
Portable
16. 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
17. 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.
18. 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.