php, mysq lpart1

16
SUBHASIS NAYAK CMC PHP, MYSQL

Upload: subhasis-nayak

Post on 10-Dec-2014

966 views

Category:

Education


1 download

DESCRIPTION

php mysql introduction, php variables

TRANSCRIPT

Page 1: Php, mysq lpart1

SUBHASIS NAYAK

CMC

PHP, MYSQL

Page 2: Php, mysq lpart1

What we will discuss ?

Here we will discuss what PHP is all about?

PHP MySql Apache installationPHP basics.

Variables & data typesFlow controlsFunctions

Page 3: Php, mysq lpart1

What php is all about?

PHP is hugely popular, and mostly used programming language for website’s backend process.

IT is a programming language that was designed for making dynamic websites.

he name PHP is a recursive acronym that stands for PHP: Hypertext Preprocessor.

Hi! I am not with time to describe more about PHP. So go the site http://php.net and check it out.

Page 4: Php, mysq lpart1

Continue …..

The PHP language is flexible and easy to learn quickly even if you have not done any programming in the past.

If you have done any programming language like c, c++, java then you can learn PHP in one night.

Page 5: Php, mysq lpart1

Installing AMP

It has three steps Installing Apache – it is very simple step by step. Installing php –

extract your php compressed package. Set the environment path. To ‘conf ‘ folder of apache=>open httpd.conf and enable all

belows LoadModule php5_module “///” AddType application/x-httpd-php.php AddTypeapplication/x-httpd-php-source.phps

Installing Mysql. Doing configuration

Page 6: Php, mysq lpart1

Configure PHP

To configure php go to “php.ini”Search for “register_global” check it for if not change

it to off.Search for “error_reporting and display errors”. When

we are writing your code enable it by doing “E_ALL”. After production disable it by doing “E_NONE”

Change the session data to store in a particular folder to do so. “session.save_path=c:/windows/temp”

The default execution time is 3o seconds. It is not possible for some scripts to complete execution within 30 secs .you can change to 10 to 15 minutes. Put the value like this “max_executin time = 900”

Save your “php.ini”

& restart ur apache

to get the effect.

Page 7: Php, mysq lpart1

Basic architecture

Browser Data baseMiddle Ware(PHP,JSP.

ASP)

Web server(Apache/IIS

)

Page 8: Php, mysq lpart1

Variables

All variables start with ‘$’.Variable starts with alpha numeric.Stay away from using underscore from at

start of variable.Variable can contain alpha numeric.

$name$var1$var_Name$varName

Good practice of writing variable

Good practice of writing variable

Page 9: Php, mysq lpart1

Working with numbers

You can do all

mathematical operation

like this?

Page 10: Php, mysq lpart1

Strings

String is a collection of characters treated as single entity.

In PHP we put a string using: Within two double quotes = “” Within two single quotes = ‘’

$myString = “Welcome to Open Source”;

$myString = ‘Welcome to Open Source’;

Page 11: Php, mysq lpart1

Bypassing the special characters

Some times we need to work with special characters which is used by the php.

Even some special characters are there for Mysql.

Some times we want to by pass the characters.We have to by pass the double quote in between

double quote.We have to by pass the Single quote in between

single quote.To do that we need to use (\) back slash before

the characters.

Page 12: Php, mysq lpart1

Cont’d …..

$str =“my Name is “Papu” ”;

$str =“my Name is \“Papu\” ”;

$str =‘my Name is ‘Papu’ ‘;

$str =‘my Name is \’Papu\’ ‘;

$str =‘my Name is “Papu” ‘;

$str =‘my Name is ”Papu” ‘;

No need of (\)

Stick w

ith one

style

Page 13: Php, mysq lpart1

Cont’d …..

Remember if you put a variable in between double quote it will replace by it’s value. In between single it the variable will be displayed.

Page 14: Php, mysq lpart1

String concatenation

We can join two strings using a (.) operator.

Page 15: Php, mysq lpart1

String comparison

We can compare two strings using <,>,<=,>=,==

Page 16: Php, mysq lpart1