PHP training in Chandigarh

13

description

PHP Training in Chandigarh is provided by CBitss which is the Best PHP Training Institute in Chandigarh.

Transcript of PHP training in Chandigarh

Page 1: PHP training in Chandigarh

7/17/2019 PHP training in Chandigarh

http://slidepdf.com/reader/full/php-training-in-chandigarh-568c6d4516641 1/13

Page 2: PHP training in Chandigarh

7/17/2019 PHP training in Chandigarh

http://slidepdf.com/reader/full/php-training-in-chandigarh-568c6d4516641 2/13

Introduction

• What is MySql ?

  MySql is an open source relational database

management system.• How MySql is related to PHP?

  MySql acts as a back-end database server and

helps in data storage and management o data

stored at MySql database server.

Page 3: PHP training in Chandigarh

7/17/2019 PHP training in Chandigarh

http://slidepdf.com/reader/full/php-training-in-chandigarh-568c6d4516641 3/13

Predefined Constant

  MySql Fetch Constant :

• MYSQL_ASSOC : Columns are returned into the array

hain! the fieldname as the array inde"#

• MYSQL_$O%& : Columns are returned into the array hain!

'oth a numerical inde" and the field name as the array inde"#

• MYSQL_()M : Columns are returned into the array hain! a

numerical inde" to the fields# %his inde" is start *ith +, the firstfield in the result#

Page 4: PHP training in Chandigarh

7/17/2019 PHP training in Chandigarh

http://slidepdf.com/reader/full/php-training-in-chandigarh-568c6d4516641 4/13

PHP MySql !unctionmysql_connect : O-en a connection to a MySql serer#

mysql_close : Close MySql connection#

mysql_create_d' : Create a MySql data'ase#

mysql_error : .eturns the te"t of the error messa!e

from -reious MySql o-eration#

mysql_fetch_assoc : Fetch a result ro* as anassociatie array#

mysql_select_d' : Select a MySql data'ase#

Page 5: PHP training in Chandigarh

7/17/2019 PHP training in Chandigarh

http://slidepdf.com/reader/full/php-training-in-chandigarh-568c6d4516641 5/13

How to connect to MySql via PHP."?php

#host $ %localhost%&

#username $ %root%&#password $ %%&

mysql'connect(#host)#username)#password*

or die(mysql'error(**&

?+

Page 6: PHP training in Chandigarh

7/17/2019 PHP training in Chandigarh

http://slidepdf.com/reader/full/php-training-in-chandigarh-568c6d4516641 6/13

&o* to Select data'ase in a ta'le#

"?php

mysql'connect(%localhost%) %root%) %%* or die(mysql'error(**&

mysql'select'db(%dbemp%* or die(mysql'error(**&

#result$mysql'query(%select , rom emp%*

or die(mysql'error(**&

#row$mysql'etch'array(#result*&

echo %"br+oll%.#row/0empno01&

echo %"br+2ame%.#row/0name01&echo %"br+oll%.#row/03ob01&

?+

Page 7: PHP training in Chandigarh

7/17/2019 PHP training in Chandigarh

http://slidepdf.com/reader/full/php-training-in-chandigarh-568c6d4516641 7/13

How to select values rom MySql table."?php

mysql'connect(%localhost%) %root%) %%* ordie(mysql'error(**&

mysql'select'db(%dbemp%* or die(mysql'error(**&#result$mysql'query(%select , rom emp%*

or die(mysql'error(**&

echo %"table width$04560 bgcolor$0lime0

border$070 bordercolor$0green0+%&echo %"tr+ "th+8mpno"9th+ "th+2ame"9th+"9tr+%&

Page 8: PHP training in Chandigarh

7/17/2019 PHP training in Chandigarh

http://slidepdf.com/reader/full/php-training-in-chandigarh-568c6d4516641 8/13

:ontin;while(#row $ mysql'etch'array( #result **

 <

  echo %"tr+ "td+%&

echo #row/0empno01&

echo %"9td+ "td+%&

echo #row/0name01&

echo %"9td+"9tr+%&

=

echo %"9table+%&

?+

Page 9: PHP training in Chandigarh

7/17/2019 PHP training in Chandigarh

http://slidepdf.com/reader/full/php-training-in-chandigarh-568c6d4516641 9/13

/is-lay data from data'ase usin! fetch_assoc function#sql $ %S8>8: empno) name)3ob !@M emp%&

#result $ #conn-+query(#sql*&

i (#result-+num'rows + 5*

<while(#row $ #result-+etch'assoc(**< echo %"br+ 8mpno %. #row/%empno%1. % 2ame %.#row/%name%1. % 3ob% . #row/%3ob%1 . %"br+%&

= =

else

< echo %:an0t And the record%& =#conn-+close(*&

?+

Page 10: PHP training in Chandigarh

7/17/2019 PHP training in Chandigarh

http://slidepdf.com/reader/full/php-training-in-chandigarh-568c6d4516641 10/13

How to insert data in a MySql able."?php

#dbhost $ 0localhost0&

#dbuser $ 0root0&

#dbpass $ 00&#conn $ mysql'connect(#dbhost) #dbuser) #dbpass*&

i(B #conn *

<

  die(0:ould not connect 0 . mysql'error(**&

=

#sql $ %C2S8 C2@ emp (ename)Dob) sal* EF>G8S(0Fmit0)0manager0)00*%&

Page 11: PHP training in Chandigarh

7/17/2019 PHP training in Chandigarh

http://slidepdf.com/reader/full/php-training-in-chandigarh-568c6d4516641 11/13

:ontin;

mysql'select'db(0dbemp0*&

#retval $ mysql'query( #sql) #conn *&

i(B #retval *<

  die(0:ould not enter data 0 . mysql'error(**&

=

echo %8ntered data successullyIn%&mysql'close(#conn*&

?+

Page 12: PHP training in Chandigarh

7/17/2019 PHP training in Chandigarh

http://slidepdf.com/reader/full/php-training-in-chandigarh-568c6d4516641 12/13

:Jitss echnologies provide a PHPtraining in :handigarh. F well qualiAed

trainer will train you on allsophisticated technologies. :Jitss

 echnologies is CS@ K55L455

certiAed PHP training institute in:handigarh.

Page 13: PHP training in Chandigarh

7/17/2019 PHP training in Chandigarh

http://slidepdf.com/reader/full/php-training-in-chandigarh-568c6d4516641 13/13

  Ofce :  S:@ 4-47-4N) >evel )  2ear Passport oOce)Fbove

  Fllahabad Jank)  Sec 7F):handigarh.  Phone :  KK7LKWebsite :  http99goo.gl9a@Ka7u  Email : navneetlinuQeQpertRgmail.com