Starting with PHP and Web devepolment


Published on

This my first ever lecture on PHP at Mawlana Bhashani Science and Technology University.

Published in: Education, Technology
1 Comment
  • IT Pathshala, Noida-Sec-63, offers Guaranteed JOB with PHP Training Programs.


    CALL US - +91-9871350999 or +91-8800394970

    Technology Centre Address: H-110, Sector-63, Noida (UP)

    Program Highlights:

    - 100% Guaranteed Job – Don’t pay us if you don’t get a JOB!
    - Industry Ready Courses
    - LIVE International Project Experience
    - Exposure to corporate culture at our IT services facility
    - Networking & Interaction with Industry Experts
    - Training provided by reputed IT Company
    - Live Project Source Code made available in CD
    - Technology certification and experience letter at program completion
    - Online Study Content
    Program Takeaways:

    - GUARANTEED JOB in your technology domain
    - Live Major Project development
    - Experience Letter on Training Completion
    - Certification on Training Completion
    - Project Source Code available in CD

    CALL US - +91-9871350999 or +91-8800394970

    Our website:
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Starting with PHP and Web devepolment

  1. 1. PHP Web Development Rajib Ahmed
  2. 2. What we will see “Today” <ul><li>Part 1 </li></ul><ul><ul><li>What is PHP? </li></ul></ul><ul><ul><li>History of PHP </li></ul></ul><ul><ul><li>Current Statistic of Apache PHP and MySQL </li></ul></ul><ul><ul><li>Setting up the Working environment </li></ul></ul><ul><ul><li>WAMP / LAMP / XAMP </li></ul></ul>
  3. 3. Cont. <ul><li>Part 2 </li></ul><ul><ul><li>Our first Piece of CODE </li></ul></ul><ul><ul><li>PHP Variables </li></ul></ul><ul><ul><li>Conditional Statement and Loops </li></ul></ul><ul><ul><li>Arrays </li></ul></ul><ul><ul><li>Functions </li></ul></ul><ul><ul><li>Is PHP Object Orientated? </li></ul></ul>
  4. 4. MySQL <ul><li>Part 3 </li></ul><ul><ul><li>MySQL </li></ul></ul><ul><ul><li>The Brothers PHP & MySQL </li></ul></ul><ul><ul><li>Data Base Basics </li></ul></ul><ul><ul><li>Our First Data Base </li></ul></ul><ul><ul><li>PhpMyAdmin </li></ul></ul><ul><ul><li>Data retrieval by PHP </li></ul></ul>
  5. 5. Explained <ul><li>Part 4 </li></ul><ul><ul><li>What Is CMS? </li></ul></ul><ul><ul><li>The Data base </li></ul></ul><ul><ul><li>Two part View </li></ul></ul><ul><ul><li>Some functions of </li></ul></ul><ul><ul><li>Best of CMS </li></ul></ul>
  6. 6. Advanced Topics <ul><li>Part 5 </li></ul><ul><ul><li>Frameworks </li></ul></ul><ul><ul><li>Zend Frameworks </li></ul></ul><ul><ul><li>Web 2.0 </li></ul></ul><ul><ul><li>JavaScript </li></ul></ul><ul><ul><li>AJAX </li></ul></ul><ul><ul><li>DoJo/ JQuery ? </li></ul></ul>
  7. 7. What is PHP? <ul><ul><li>PHP stands for &quot;PHP Hypertext Preprocessor” </li></ul></ul><ul><ul><li>An embedded scripting language for HTML like ASP or JSP </li></ul></ul><ul><ul><li>A language that combines elements of Perl, C, and Java </li></ul></ul>
  8. 8. History of PHP <ul><ul><li>Created by Rasmus Lerdorf in 1995 for tracking access to his resume </li></ul></ul><ul><ul><li>Firstly Known as “Personal Home Page” </li></ul></ul><ul><ul><li>Rewritten again in and released as version 2.0 in November of 1997 </li></ul></ul>
  9. 9. History of PHP <ul><ul><li>User base in 1998 estimated 10,000 users and 100,000 web sites installed </li></ul></ul><ul><ul><li>Version 3.0 was released in June 1998 as PHP </li></ul></ul><ul><ul><li>Php Current version of release is 5.2.5 November 2007 </li></ul></ul>
  10. 10. Current Statistic <ul><li>Performance* </li></ul><ul><ul><ul><li>PHP pumped out about 47 pages/second </li></ul></ul></ul><ul><ul><ul><li>Microsoft ASP pumped out about 43 pages/second </li></ul></ul></ul><ul><ul><ul><li>Sun Java JSP pumped out about 13 pages/second </li></ul></ul></ul>
  11. 11. Setting up Working Environment <ul><li>Manual Configuration </li></ul><ul><ul><li>Install Apache </li></ul></ul><ul><ul><li>Install PHP </li></ul></ul><ul><ul><li>Install MySQL </li></ul></ul><ul><ul><li>Configure Apache </li></ul></ul>
  12. 12. Config Apache <ul><li>C:apacheXX </li></ul><ul><ul><ul><ul><ul><li>Httpd.conf </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>LoadModule Php5_module C:/php5/sapi/php5apache.ddl </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>AddType application/x-httpd-php .php .html </li></ul></ul></ul></ul></ul>
  13. 13. WAMP/ LAMP/ XAMP <ul><li>Preconfigured Package. </li></ul><ul><li>WAMP => Windows Apache,MySQL and PHP </li></ul><ul><li>Run The installer on Windows. </li></ul>
  14. 14. Bonus <ul><li>Text Editor </li></ul><ul><ul><li>Notepad </li></ul></ul><ul><ul><li>Dream Weaver </li></ul></ul><ul><ul><li>PHP Designer </li></ul></ul><ul><ul><li>Eclipse </li></ul></ul>
  15. 15. PART 2 <ul><ul><li>Our first Piece of CODE </li></ul></ul><ul><ul><li>PHP Variables </li></ul></ul><ul><ul><li>Conditional Statement and Loops </li></ul></ul><ul><ul><li>Arrays </li></ul></ul><ul><ul><li>Functions </li></ul></ul><ul><ul><li>Is PHP Object Orientated? </li></ul></ul>
  16. 16. Our first Piece of CODE <ul><li>The Script Tags </li></ul><ul><ul><li>All PHP code is contained in one of several script tags: </li></ul></ul><ul><ul><ul><li><? // Some code ?> </li></ul></ul></ul><ul><ul><ul><li><?php // Some code here ?> </li></ul></ul></ul>
  17. 17. <ul><li>The Hello World Example </li></ul><ul><ul><li><?php </li></ul></ul><ul><ul><ul><li>echo “Hello world”; </li></ul></ul></ul><ul><ul><li>?> </li></ul></ul>Our first Piece of CODE
  18. 18. Variables <ul><li>All variables starts with $ </li></ul><ul><li>i.e </li></ul><ul><li>$var1 =“ Motiur Sir” </li></ul><ul><li>and </li></ul><ul><li>$var2 =“ The Boss !!” </li></ul><ul><li>How to print “ Motiur Sir The Boss !!” </li></ul>
  19. 19. Exapmle <ul><li>The Hello World Example </li></ul><ul><ul><li><?php </li></ul></ul><ul><ul><ul><li>echo $var1.$var2 ; </li></ul></ul></ul><ul><ul><li>?> </li></ul></ul><ul><li>Output </li></ul><ul><li>“ Motiur Sir The Boss !!” </li></ul>
  20. 20. Conditional Statement <ul><li>Conditional Statement </li></ul><ul><ul><ul><li>If (condition) </li></ul></ul></ul><ul><ul><ul><li>// some code </li></ul></ul></ul><ul><ul><ul><li>else </li></ul></ul></ul>
  21. 21. Conditional Statement <ul><li>Also </li></ul><ul><li>elseif (condition) </li></ul><ul><li>Switch (condition) </li></ul><ul><li>Case XX : </li></ul><ul><li>// Some codes </li></ul><ul><li>break; </li></ul>
  22. 22. Arrays <ul><li>Very important Topic </li></ul><ul><li>Declaring an array </li></ul><ul><ul><li>$arrayExample= array(); </li></ul></ul><ul><ul><li>$arrayExample= array( </li></ul></ul><ul><ul><li>‘ Nazrul Islam’, </li></ul></ul><ul><ul><li>‘ Is’, </li></ul></ul><ul><ul><li>‘ COOL’ </li></ul></ul><ul><ul><li>); </li></ul></ul>
  23. 23. Built in Function : print_r() <ul><li>I use this function for Debugging </li></ul><ul><li>print_r( $arrayExample ); </li></ul><ul><li>Output: </li></ul><ul><li>Array ( [0] => Nazrul Islam </li></ul><ul><li> [1] => Is </li></ul><ul><li> [2] => COOl!! ) </li></ul>
  24. 24. Functions <ul><li>Two Types of Functions </li></ul><ul><ul><li>Built in Functions </li></ul></ul><ul><ul><li>User defined functions </li></ul></ul>
  25. 25. Built in Function Example <ul><li>bool empty(); </li></ul><ul><ul><li>empty -- Determine whether a variable is empty </li></ul></ul><ul><li>bool isset(); </li></ul><ul><li>isset -- Determine whether a variable is set . </li></ul><ul><li>string date(); </li></ul><ul><li>date -- Format a local time/date </li></ul>
  26. 26. User Defined Functions <ul><li>Starts with keyword function </li></ul><ul><li>Our first function </li></ul><ul><ul><li>function you_fail ($name ) </li></ul></ul><ul><ul><li>{ </li></ul></ul><ul><ul><ul><li>echo “ Sorry $name you have failed ” </li></ul></ul></ul><ul><ul><li>} </li></ul></ul>
  27. 27. Is PHP Object Orientated? <ul><li>PHP is basically procedure oriented Scripting language </li></ul><ul><li>PHP is object oriented from PHP 4.xx </li></ul><ul><ul><li>it had some limitations </li></ul></ul><ul><li>PHP‘s OOP support is very good a PHP5 </li></ul>
  28. 28. MySQL <ul><li>MySQL is a open source Database </li></ul><ul><li>This year in February Sun Has bought MySQL </li></ul><ul><li>It very popular in the WWW </li></ul>
  29. 29. The Brothers PHP & MySQL <ul><li>There integration is great </li></ul><ul><li>PHP has lots of built in functions MySQL </li></ul><ul><li>PHP has built lots built in functions for other databases too. </li></ul><ul><ul><li>i.e. ORACLE, PostgreSQL, DB2 </li></ul></ul>
  30. 30. Database Basics <ul><li>Designing a database </li></ul><ul><ul><li>Thinking about the relationship between data. </li></ul></ul>
  31. 31. First Normal Form <ul><li>First Normal Form </li></ul><ul><ul><li>Each column in a row must be atomic. </li></ul></ul><ul><ul><li>Each row in a table must contain the same number of columns. </li></ul></ul><ul><ul><li>All rows in a table must be different. </li></ul></ul>
  32. 32. Second Normal form <ul><li>The table must be in first normal form. </li></ul><ul><li>All nonprimary key columns in the table must be dependent on the entire primary key. </li></ul><ul><li>Why Normalization ? </li></ul>
  33. 33. Why Normalization ? <ul><ul><li>Key point : Reducing data redundancies. </li></ul></ul>
  34. 34. Our First Data Base <ul><li>Creating a StudentInfo database on MySQL </li></ul><ul><ul><li>Creating a Student table </li></ul></ul><ul><ul><ul><li>fields </li></ul></ul></ul><ul><ul><ul><ul><li>id </li></ul></ul></ul></ul><ul><ul><ul><ul><li>stu_name </li></ul></ul></ul></ul><ul><ul><ul><ul><li>stu_id </li></ul></ul></ul></ul><ul><ul><ul><ul><li>stu_faculty </li></ul></ul></ul></ul><ul><ul><ul><ul><li>stu_dept </li></ul></ul></ul></ul>
  35. 35. Use PhpMyAdmin <ul><li>PhpMyAdmin is client program </li></ul><ul><li>We will see the use PhpMyAdmin </li></ul>
  36. 36. Data retrieval by PHP <ul><li>Step1: setting up - user ,host, password </li></ul><ul><li>Step2: connceting to mySQL </li></ul><ul><li>Step3: selecting database </li></ul><ul><ul><li>selecting studentInfo database </li></ul></ul>
  37. 37. Step1 <ul><li>define ( host, &quot;localhost&quot;); </li></ul><ul><li>define ( user, &quot;root&quot;); </li></ul><ul><li>define ( pass, &quot;&quot;); </li></ul><ul><li>define ( DB, “studentInfo&quot;); </li></ul>
  38. 38. Step 2: <ul><li>$con = mysql_connect ( host ,user ,pass ); </li></ul><ul><li>if( ! $con) </li></ul><ul><li>{ </li></ul><ul><li>echo &quot;Error in connection &quot;. mysql_error(); </li></ul><ul><li>} </li></ul>
  39. 39. Step 3 <ul><li>$DB_sel= mysql_select_db ( DB , $con); </li></ul><ul><li>if( ! $DB_sel ) </li></ul><ul><li>{ </li></ul><ul><li>echo “Database Not Found &quot;. mysql_error(); </li></ul><ul><li>} </li></ul>
  40. 40. Query <ul><li>$query_str =‘SELECT * FROM STUDETNS ’; </li></ul><ul><li>$result = mysql_query ( $query_str ); </li></ul>
  41. 41. Displaying Results <ul><li>while( $row = mysql_fetch_array ( $result ) ) </li></ul><ul><li>{ </li></ul><ul><li>echo </li></ul><ul><li>$row[ ‘stu_name’ ]. ’’s roll is’ .$row [ ‘stu_roll’ ] ; </li></ul><ul><li>} </li></ul>
  42. 42. Explained <ul><li>Part 4 </li></ul><ul><ul><li>The Data base </li></ul></ul><ul><ul><li>Two part View </li></ul></ul><ul><ul><li>Some functions of </li></ul></ul><ul><ul><li>What Is CMS? </li></ul></ul><ul><ul><li>Best of CMS </li></ul></ul>
  43. 43.
  44. 44. The Data base <ul><li>Database name MBSTU </li></ul><ul><li>Tables on DB </li></ul><ul><ul><li>faculty </li></ul></ul><ul><ul><li>department </li></ul></ul><ul><ul><li>menus </li></ul></ul><ul><ul><li>page </li></ul></ul><ul><ul><li>content </li></ul></ul><ul><ul><li>news </li></ul></ul><ul><ul><li>teachers </li></ul></ul><ul><ul><li>teachers_designation </li></ul></ul><ul><ul><li>results </li></ul></ul><ul><ul><li>and more </li></ul></ul>
  45. 45. Relation between tables
  46. 46. Two Part view <ul><li>This is used for repetitive parts on the HTML pages </li></ul><ul><li>Header </li></ul><ul><li>Footer </li></ul><ul><li>Navigation </li></ul>
  47. 47. Header
  48. 48. Footer
  49. 49. Navigation
  50. 50. Some functions of <ul><li>function get_all_faculty_name( ) </li></ul><ul><li>function get_dept_name( ) </li></ul><ul><li>function get_all_depertment_name( ) </li></ul><ul><li>function get_page_content ( $page_id ) </li></ul><ul><li>There is many more important and more complex functions </li></ul>
  51. 51. What is CMS <ul><li>CMS is Content Management System </li></ul><ul><li>Where Content is modified without editing any HTML. </li></ul><ul><li> is a custom CMS </li></ul>
  52. 52. Joomla <ul><li>This is a open source CMS </li></ul><ul><li>It is the new buzz word in PHP world </li></ul><ul><li>By learning Joomla you can real good jobs </li></ul><ul><li>Look for that. </li></ul>
  53. 53. Advanced Topic <ul><li>Part 5 </li></ul><ul><ul><li>Frameworks </li></ul></ul><ul><ul><li>Zend Frameworks </li></ul></ul><ul><ul><li>Web 2.0 </li></ul></ul><ul><ul><li>JavaScript </li></ul></ul><ul><ul><li>AJAX </li></ul></ul><ul><ul><li>DoJo/ JQuery ? </li></ul></ul>
  54. 54. Frameworks <ul><li>Frameworks is abstractions layer for implementing common tasks. </li></ul><ul><li>Frameworks implements “Design Patterns” </li></ul>
  55. 55. Zend Frameworks <ul><li>Zend is developed by Zeev Suraski and Andi Gutmans </li></ul><ul><li>This implements OOP </li></ul><ul><li>Zend implements MVC ( Model, View, Controller ) </li></ul><ul><li>This will be a great Frameworks for future </li></ul>
  56. 56. Ajax <ul><li>Ajax is Asynchronous JavaScript XML </li></ul><ul><li>This is not a programming language </li></ul><ul><li>Its term Defining Web 2.0 </li></ul><ul><li>Ajax example Google suggest, Google Maps </li></ul>
  57. 57. DoJo / JQuery <ul><li>This two JavaScript libraries are used for implementing Ajax. </li></ul>
  58. 58. Conclusion <ul><li>if you are planning a future in web development </li></ul><ul><li>HTML, CSS, PHP and Ajax will help you build one. </li></ul>
  59. 59. Thank you all for your patience