Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on

Published in: Technology


  1. 1. Govt. Engineering College AJMER A training presentation on : PHP with MySqlSubmitted to : Submitted By :Mr. Vinesh Jain Ajeet Kr. Jhajharia 09CS04
  2. 2. Content : Company Profile History of php What is php ? Features of php php code look like Php Contents Advantage of php MySql
  3. 3. CEG : Center for Electronic GovernanceCEG is an autonomous body of the Govt. ofRajasthan under the department of technicalEducation.Foundation stone of CEG was laid down on 8thDecember 2006 at Khaitan Polytechnic CollegeJaipur by Shri Ghanshyam Tiwari and ShriVasudev Devnani, Hon’ble Ministers forTechnical Education.
  4. 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. 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. 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. 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 Easy to Learn – Very similar in syntax to C and C++ php uses both procedural and object oriented paradigms.
  8. 8. php codes look like ?  Each PHP script must be enclosed in the reserved php tag . <?php … ?>
  9. 9. php Contents: Variables Constant Operators Array Functions
  10. 10. Variables : Variables are used for storing values, such as numbers, strings or function results, so thatthey can be used many timesin 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
  11. 11. Operators : Arithmetic Operators (+,-,*,/) Example:- $total=$a+$b; Assignment Operators(=) Example:- $t=$a+$b; Comparison Operators (<, <=, >, >=) Logical Operators (&&. ||,!)
  12. 12. Arrays: <?php $arr = array("somearray" => array(6 => 5, 13 => 9, "a" => 42)); echo $arr["somearray"][6]; // 5 echo $arr["somearray"][13]; // 9 echo $arr["somearray"]["a"]; // 42
  13. 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. 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. 15. Advantage of php : Open source Procedural / Object Oriented programming Supports wide range of Databases Easy to learn Portable
  16. 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. 17. MySQL Query Basics mysql_connect() :- This function returns the connection onsuccess, or FALSE and an error on failure. mysql_select_db() :- The mysql_select_db() function sets theactive MySQL database.
  18. 18. MySQL Query Basics mysql_query() :- The mysql_query() function executes a query on aMySQL database. mysql_num_rows() :- The mysql_num_rows() function returns the numberof rows in a recordset. mysql_fetch_array() :-The mysql_fetch_array() function returns a row from arecordset as an associative array and/or a numeric array.
  19. 19. Project Snapshots Project: Student Information System