PHP and MySQL

Preview:

DESCRIPTION

The presentation used on Software Freedom Week on Day 2, the web day (11-oct-2011) about, PHP and MySQL

Citation preview

PHP and MySQL

Some Basic Concepts

• Webpages and Website• Web Application: Design And Development• Design- HTML,CSS and other design concepts• Development- Scripting !• Client-Server Architecture

Static & Dynamic Pages?

Dynamic Pages

• A dynamic web page is a kind of web page that has been prepared with fresh information (content and/or layout), for each individual viewing. It is not static because it changes with the time (e.g. news content), the user (e.g. preferences in a login session), the user interaction (e.g. web page game), the context (e.g. parametric customization), or any combination thereof.

Server-side Scripting• It is a web server technology in which a user's request

is fulfilled by running a script directly on the web server to generate dynamic web pages.

• It is usually used to provide interactive web sites that interface to databases or other data stores.

• This is different from client-side scripting where scripts are run by the viewing web browser, usually in JavaScript.

• The primary advantage to server-side scripting is the ability to highly customize the response based on the user's requirements, access rights, or queries into data stores.

Some scripting languages:

• PHP (*.php)• JavaServer Pages(*.jsp)• ASP• ColdFusion Markup Language (*.cfm)• Perl (*.pl)• SMX (*.smx)• Python (*.py)• Ruby (*.rb)• Lasso (*.lasso)• WebDNA (*.dna,*.tpl)

Apache- The PHP web Server

• Apache (By ASF) is THE webserver with complete PHP support

• Notable for playing a key role in the initial growth of the World Wide Web. In 2009, it became the first web server software to surpass the 100 million website milestone

• Works with almost any OS• Apache was estimated to serve 63% of all

websites and 66% of the million busiest.

Where?

Facebook

Wikipedia

PHP: Hypertext Preprocessor

• Born on June,1995. • Widely used, general-purpose scripting language• Was originally designed for web development to

produce dynamic web pages.• These scripts were written as C programming

language Common Gateway Interface(CGI) binaries, extending them to add the ability to work with web forms and to communicate with databases and called this implementation 'Personal Home Page/Forms Interpreter' or PHP/FI.

PHP supports many DBMSs…

• MySQL• Informix• Oracle• Sybase• Solid• PostgreSQL• Generic ODBC etc.

MySQL

• Initially released on May, 1995.• MySQL is a relational database management

system (RDBMS) that runs as a server providing multi-user access to a number of databases.

• Written in C,C++ !

• Wikipedia-depends upon the LAMP platform• Uses an array of 5 MySQL servers • Processes 200 million+ queries• 2 million updates daily• Illustrative of MySQL’s capabilities in a high

read and high write environment

• Yahoo! Operates on the FreeBSD platform,an open source Unix variant

• http://finance.yahoo.com/ uses FreeBSD and MySQL back end

• Billions of Monthly usage. (Yes, Billions)

Why PHP and MySQL?

• Childhood Friends • Free and powerful• Written in C,C++. This Combination makes

implementations faster

More importantly…

• because of the stability, • the lower server costs (Linux Servers - Apache

HTTP Servers) than hosting .• Net applications • and the availability of ready to use Open

Source Software Applications on the Internet.

LAMP

Are you ready to code?

If(lamp||xampp)return true;

elseIf(apache && mysql==true)

return true;else

Visit GLOSS website !!

Talk is cheap. Show me the code

-By ???

PHP Basics<?php

/*code here */echo “Hello World” ; //end with ;?>

•Weakly Typed, $var_name = value; •Arithmetic, Assignment, Comparison, Logical operators.•Conditionals and loops – Same as C. Just use echo “ print this !“; //instead of printf()•Functions:

function functionName() { code to be executed; } //Call using function name

SQL Basics

• Either use the GUI (Say phpMyAdmin, MySQL query browser), form or menu based systems or

• Use SQL scripts.

PHP-MySQL Connectivity

• Follow these steps– Connection //mysql_connect()– Creation/Selection //mysql_select_db()– Query //mysql_query()– Connection Close //mysql_close()

Want More??

Use Existing PHP frameworks to code faster and clear for Real-Time

Applications

PHP Frameworks

• CakePHP• Zend• Symfony• CodeIgnitor• Akelos• Recess• PRADO

Online Resources

• HTML – http://htmlhelp.com/reference/html40• PHP – http://www.php.net/manual/en• PHP Libraries• http://en.wikipedia.org/wiki/List_of_PHP_libraries• MySQL – http://dev.mysql.com/doc/refman/5.0/en/• BROWSER – View Page Source• http://www.w3schools.com/• OpenSource Applications – http://sourceforge.net/• And,of course,GOOGLE!!!! – whatever you want is

out there

Now, What Next??

Why PHP is preferred than ASP?Is PHP object-oriented or procedural?

Learn advanced topics on PHP and MySQL

Opportunities?

And finally…

//Build your own “Dynamic Web Application”//

Adios!

Feel free to contact me @

manigandan.balachandran@gmail.com

facebook.com/manigandan.balachandran

twitter.com/manigandan_b

Manigandan,B III CSE +91 9677216418