100% found this document useful (2 votes)
1K views314 pages

Swamynaidu Sir (PHP Notes) PDF

Uploaded by

anil kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
100% found this document useful (2 votes)
1K views314 pages

Swamynaidu Sir (PHP Notes) PDF

Uploaded by

anil kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 314
PHP By Swamynaidu Naresh Technology sri RAGHAVENDRA XEROX Software Languages Material Available Beside Bangalore Ayyangar Bakery, Opp. C DAC, Ameerpet, Hyderabad. Cell: 9951596199 SS PAR, fae rent side % HIML, css Server Gide % PHP, TsP, ASP PHP is Used to develop Keb Applications, Pur (personal Home Pye) (Hypertext Preprocessor) PHP: pre ts a server side Scviptin: tanguy ¢ implemented by Rasmus Lerdgip fp 1995 using ‘c? and ‘pert’ Technslegres. By using pr we can develop Dynamic Web Apprication. Staric Webpayes Oly informat? displays. EX! Newspaper. Dynamic Webpages Kle cay hegio Ex! Gail, Facebook» Pt ' PHE gtonds for Personcd Home page and aise iPis condeing 5? Dios Mame Hier Tree Hypertext Preprocessor. Rosmus kerdorf tmplemented PHP 1.0 to Find our had many companies accessing his Resume Hhrough Online, He used 'e? and “per?! Fechnolegies for this impre mentorion, Apache $ Open Source free Server. TI9: NES Used that Server. 3 a : y Mys@i te a Open Source and any PHP can directly contod With OAR p? MYSQL, 30 there #5 a Cormbinai? of mysar § FHP. 2? PHP Appiicdtion ¢ Focebook ° ASP Application : orkur Bg Norer SET PHP Prointained by Xend Oppenizarion. i bo Bate § 14 AVG 2013 pe # Features Of PHP? @ [DCHess Platform + £ con run ander any types of operating System. > @ 7LCxe6s Server! Ta cay run under diff. types of Webservers, wike FLS, Apache, Tome! By YEross Patadaset se cupports any Npe of Databare Server. . 5 “PPP 50 MYSAL! php 5.0 39 providing Mys@l. Librory Ye inbercrch wiith MysR! 0B. oo PAP Supports Ne. of objed onertef Pregramming conceple Ue Taheridaoee, } Access Specifies ete- 3 Gh pap ts open Source » OR pre supports digp typeof comtent management S/d Tike JoomA, DRUPAL, Y @ — lordpress ete Art Cms (content Management 57st) -F]w are opensource sl Y i cee ee emer 9 BD PP providing Number of security ps to apply Secusily to opplica. 9 away Encryph?, 2-way Faery e?, Auphenti card eke. : > PHP supporting diff. bypes OF EXitors to develop Prep, Wwe Can aso 9 use ryybhaeig + “Editors (Notepad, Editplus f1<) 0 12) Pte execur? 15 Very Fast Book, of Zeng Engine. Oo "™ Zend organiza? 78 matotosning the pup seriph They introduced number r OF joors fo work WIth PHP Svadse mex WE provid O Cornprere Support P te PNP programmers thr online. Cy 12) PHP is veryMeasy fo Understand § Deyelop the Apprica??. y Pate: 16 Ave zo13 ee A Versions of PHP * = = ID ') PH 1:0-(1998)$ Igy —————— B Resmus terdorf implemented PHP 1.0 using for Sper! oy S/N: i) Fh is Mot A Seryer Side Scripting Ia »2 418) Smplementay” from ‘ce’ & pes)’ Soflwores, 30 %) PHP &0 (2997)2 7 Ty Rasmus Lerdorf implemented PHP 20 a9 Parriany 90 Server-eide scripting Vonguage, 95 i) PHP 2.0 Supports different Dypes Of Database Servers. oO 9 i}swe can fmplemest some Hpes OP modules usiog 20 those are ae regisrrotion, 2egin, ete. oO BprPne 3.0 (4998): oo DPrp 20 i fury server side seripriny loqqugre. oO. I) Zeey Suraski § Andi Gutmons rewritten the functionalities of PrP e ° fromm sevadeh. on released it 3-0 08 fully Server side Scripting ley ° hy PHP 3.0 Supports dipferent plotforms (oper ading yh) ot iy) Persenc? Homepage fs Renamed as Hypestex? Preprocertor with adic Yer ston. 8 ° A) PHP 4.0 (aoe): a NPne Ao is Cross server, 1 Supports IIb, APACHE, Tomtcar ede: BR Rend Engine 4:0 ¥s fowroduced in PHP 4.0, Zend Engine is Rusitime Environment of pup Appiico??, Ty Smarty Foplohing Syst. is totreduced With this Version, We Can shop y ctevelop the Applica” with Predefined Temprater. 5? Pip 5.0(.g004505 iy Ip The mojor upgrade of pnp s.o te Object Orteneg Preggrormig Supporh tip Rend Engine 2-0 fs introduced With Pup 5.0 ™ooococoe TD dOmL ang Webservices réladed classer are introduced with pnp 5&3) & pire 60 3 i) The moin Focus of PHP 6.0 1s Unicode Support meane Programmers Con oble FO name. Heir closses and methods With MherNarive Jappuepes. liy Some Advanced Object Oriented thar Concepts Tntroduced WIM Pyro rai Those are Namespaces, and Laie Static BMdiy Ka oe * pup ts farriony Cose sensitive Lang, Jn f point of view ibis case bensitve And Yoriables point of view it io case sensitive. x Every Statement in pre, we shoutd end with semicolon * PHP Ts Looselp typed long vy je Thars why no Need to provide Datatypes a? the Hme Of yarfoble dectovor®, # Yariable Names fn PHP Shoug storks With 'g'Coonar) $7 mbo)- + Every PHp file extension should be -PHP. # PUP serfpt We Should include within the Script Decora?” sryre res: a waner st pveang TO Mebserver fs a S/W used fo run Phe web Applica fr hondies the wequest from Client and Sends the Tespense to the clienk EX! ©£e, Apache, Tomcat ete. Xeb Browser? 7 =“ is 9 B/W) Used to open Web applica?s from Webserver, Ext Zorerne? Explorer, Mozilla FireFox, etc Request? ease 4 Request ts a Trip of Webpage From Bronses t0 Server. BEE sayin gaits com Response! a SSE, Server gends the Ofp for Client request in the form of Response. ClFeot Side Script? The Script which execudes Client system with the help of hiebbrowser can be Coiled Of Civent_side Script. EX! BREHTML, Javascript ete de Script? i » ‘The Script executes the Webserver Wirh the help of Server engine: User con't See jhe origina) Script of Server side. Soiplig Tangueges EXS PHP, ASP, SSP ete. oP conty A Tools To Work With PHP S 1) Ww (Stands for Windsws APACHE MyS@L and PHP) , These too) : Supports Windows os. a 2) LAMPS ? kane. Chanux APACHE MYSQL ond PHP). ZF CAD run Under Linu os, HK 3) XAMPP! » (XPERF for any Oper aring Syst, APACHE, PIYSQL PHP FS peat) pools ore Open Source 7eols avoilable iM orgf. extensions, A these a RD Run a PIO. 19 Other Deive? 26 anlar? pt . 2Cidvive-> Kampp-yapache—>Conp—> F A Lnorerar? oF PHP? (xampp 4-7-2) Bepd > ete i Apter Enstorar® of xAMPP, We Con Find ou? KAMPP Forder in the wanby Destinw” Jocor” contains nuroder of subferders. Pets Sle!» orcas Root wm " “Frleney Dy hidocs$ —yPress SHimer 5 > —_’ Tr echor Et ts He root Pirectory of APACHE Serv Air php Preyrame ‘ We should save a} this Iocot?. a g9 tmp: , F FF 3S Temporary Mem loca? of Server. AN Uplooded Files ang ao Sessions WN store at Mis Poco??, a5 Php? o, <== This forder contolns php conpfgarar? seni php.ini v's congggurai gy Sertings File oF PhP- apache? AELOE apache contuins opache conpiguro®? ser oge bepd. conf Vs apache oe eget Filename. mysq? mysql contains mysq) conFigara?® serings Myton as conggguee2” seniegs pire Pre $ H sreps to create and Execute Biggar’ Fmplement . 1) Open Editor ang SPede Dip Serip) using Script Declare?” sryre ays 2) Save this file 1 the rook directory with extensions php! 3) open xAmeP control panel & Start opoche seryer. oD) open Browser and send the request fe the Server to get Me O/P of Php pile “eoceoocoeooecooee 7 Deciarats‘on style Tag of php’ Poder Al-AUe-goss a ig 2 php te providieg ferent Types 6 declardtyon style Tags ') vntyersa style Tags This Tog Suppers ot funciona? 2 sh Asp shyte Tag? We can add php script WItHIn asp declosdd? syntax, . Kh vee kD 4) Scrip pyre Tags Tt Ta Simior te_fovascript declaration syorax, Bo ye hoye 2 Con pigurat? senigg io Phpiini related Jo decdoraPstyie rye The dgoutt yarve fs" ofr" for Short open Tags § asp dogs. By chaayieg me Yolue we Cao Execure HIS Teg. we need bo Restart the server to see thechayger A Quiput funerions in Php! | ")_ Prin? This p9 displays ofp 09 Browser & Returns a Boolean ydlue True’, P| Ofp is printed Succes ofuny, otheradive Falee, We Cannock prin? muripe oreo WITH single pris statement, \ LNore! $n php, the value Of True is *1* and False means *Noyvalue’ : Er 3) ra using tris F?, 926 con dispray fp With Phe help ef Forma? epociptee EE string . en 'e 2p we not write phese 2 ives Error stod. Zt give gee 3 : pnerpeeed '* 3 Parse ervor® compound Datatypes: 1) Array ¢ Coneck? of Elements, 2) Objecht Instance of a clase. t Specta) Datatypes 2 Resource parayp A Th oreperrs the externa) Resources Ike Database Conn”, FTP conn, File pixs ete. Ex: <2 php Q F.cen emysql_connect(*oca) host” "rogrt, » *), SAVE AS? > echo $conx bry)"; “ ResourceDatalype: php echo op = d Ger- resource ~?ype($ con); ==" Resource id #2 } zy Mysql tink ) y Nun Daraype Fo php, nun ts nora Value we can consider a -variobre 9 as Nun variable based on 3 cond? i) TF the varfable fe not sebs Wir ony Yolve, , iy SF the Variable fs Se? With Nu?? ‘Value, o iihzp the value of Variable fs Uose Q « > unt . By ustog this £9, We con check gubether the vorvable fe NUD? op No. 10 L115 20 £23) for e 9 3) <2 php at Array2. php $ ons: Ore0y (10,"seor", $0); U priot_» (far); o echo farr[1], % We can create Arroy with Expricit Keys SE? Seon, 23 AUGUST 4012- KU php SAVE AS! Arrayd.php flarr = oey fen, (0910, 1-7'scott", 25 30), SLE! Array (601-9 10L1]- Seon eed (for); a) ? Note! rf We dont provide an Explicit key to an Array Element, The Ned Rey ts depending upen previous eps of tha? Erement. First Fr cordeats any previous Keys Finding rar wey 1 Theo addit 10 the maxPkey & provide the Reauttan? Yowe as Key Ye the Hew elemend. A php g arr = orroy (30, 1o0=>"Scort" , 3°), pian (forr); i > 2 ¢ ee 10 \ Lio] > Scot L101] 7 80 BE KE phe far 2 arrey (10,20,0 > 30); primey (for7), % Ex: <8 php Fors -arroy(), Forte] ® Ext <2 php f ares arrey 0); F ory [rong] tpn et Parr Conansger']= "Sooty Print_o (fara); » ° ° . Key o. We can provide stag os Array Element a! This concep? 1 carved os Assoctative Array. COUNT Save Ay: Array 4. php Saye As: Arrays, php GE! Array (£0} > 10 4] 920) SAVE AS! Associdti ve Array. php This FO Returns feta? no. of Array Elemente. <& php f arr carroy (10,20, 30), ©cho count (far); *) Sort ty This PP ovranges the Array keys » fe

- Elements in Ascend? SAYE AS! gawk. php Sorts. ia fo Saye As: Gt php Aine oP: [o]=5 [1] =20 [2] 20 La] =30 > Same ofp as above 8 Array ( Lo] 30 Ca 20) 2 Arvey (LLong] = pHe LMangger]> ¢ OS "yy order With nad @.9 PESCooCoCeEoCeoooeooooe sows edd dw . vy ecoev Ow c 90), Atitelp sort = Cforr); Prist_y (orn); » Kkrsorts Descendtag ordey bosed on Array keys. arroy. sum! To ger the sum of Array Elements. EX? <2 php foory = arroy (10,20, 30). OYP 3 60 echo axsoy. sum (forr): ~ * Ext ar roy. product ¢ ie the product of elements, xt = tone $arrs arrey (10, 20,30) Scho orrey_ product (farr), D ©) “Arranges Array Elements Descending Order. With the ned ‘Keys. Asort? Sayess. PE Olt: Array (Coleyae C11 920 CaJaio cas Prog" Chore); Garey — unshipt! By using pis ¢? we can add an Element a} the beptoing of Array § Returns the toro? no. of Arroy Elements, eccocceoccoooe$o 2 ceceoococecceaeeeousdc c Ext <2 php J or 2 orroy C10, 20,80); echo orroy_unshift (forr,5); print—r(farr); This FO creates o new array by combining the elemends OF 2 Arrays. New array %& keys Ore Volues of © Array. New Arrey Yoles axe Valves of I tArray Ee, 20) i Prints Carroy_ diet key (farnt cfarra)), b % ‘G This po divides a sity as Array Elements based on Lip value. EAS K2 php $ Str = "Welcome", ote Sarre explode (*e", ¢ shy) Array Privt_y (fare), £079 w % 07 9 leon ) This £9 Combiner array elements a9 0 sprig. E22 @php es $4h= array (10, 20, 30); oe * 10@20@30 Echo mnporode ( "@h.forr); > Sr Off 1 6@/ 208/30 extrac This po divides the ogsociative array elements os variables Frem Jrray, ae Borr= array (‘d'=p 10, 'b') 20,1 sduBo) erhract (far); Ctr: echo ga; a echo $b; ee b b= 20 AY AUGUST £013 Ny using this F2we can ascend array elemends into phe Variabies. =o ‘ air ay. keys: This FO reluens al the Keys of on array as a New aTToy, 44); als (ar70)_keys ($0r1)), *) arr oy_mege: SEE MES To ewe the elements OP 2 Arroyo. Ex Bone a of y eerie {oirrryaean se, printer oe forrt), ; auith 90. of occurances For each value. Ve ~The FD displays array elements jn rhe Reverse dix”. EE returns a warming me and executes rest of the Stobernente Ex? <2 php Pace 1) bocat Yortable s Vortoble declarod? within the F? comes under 70 ¢a? Vvartabie declara?? hoca? Varfables we can access Within the Fr where we declared. We cannot access from outside rhe F%. Cx? gee a Pe = Scotk Static Yarfables! a) Stovic Variables can Mointafn the previous values we can asstgo the values only one time frto starfe variable. Ext php en Fun.) On 101 102 103 5 a 4%-100; |] Zp we dont Write Shabic here, Then the xtt; erate Ofp WIN) Lod Los Lon } So, We Use static ‘keywords 7 Font); ie0 Fun eo; iy S Lol 102 103 POM SY Os ie2 I 2) d . 3 Referrence Yasvabte Ih referres the volue of nether yarisble 3 Actwal Varieble and Reperrence Voriable refers: the Value of same 3 address locat? @ J ma. » Ext <2 php pachaee wy 9 $x= 1005 oe E> o $y $92; I Wti00 ¢ a $y = 200; ae echo $2; 2 i) ° 2 vVorfables? e ‘ables! Super Globo) Vorablss 5 : / a php ts providing 0. of Supre Globa? Varrabyes de Can access phis Super Gleba? ‘Variables from aoy Toca (From any Q ° Nebpeye) Within rhe project. Pipperen® types OF Super Globa? Varvebies are avasiabie. Those ereO $ GET, $~ Post, #- REQUEST, $-SERYER, ¢ SESSION, $~ CooKrE, F_ FILES, QO $-ENy. AN Super Global voriabler Qxe array dodatypes ecececceo ~ www Coe Oo eeece@eedn oc o oecece o To HTML, Form v's a Contatner con held Sip con’ Zp U want 0 x\perr He Values oF S/p controls From tp PYe +, BE yay cick on SuBMsT Burt We con go for ‘When User Aribures of Font Tagt l) ActzON 8 Sa By asitg Poge we can redivech form Yalueo. 2) By uste we are uctog fo fers the form volver, The poscibte BLENC Type? . Type? data. ext == Xform Action ="payer htm? method ="posr’? Kopriony Pup »
: "? GJ EI El name: 'h2! > uC K4_rrbest al By using phils Super qgtobad variable we Cancger the ingore? op Uplooded files 17 7s 2 Aimenstonad array Variable providtioy 5 elemenss. Every element Used Hhe Complete fogorm about Uploaded File. Each elernend Firsh dimension fe name of Upload Con?r? RI=AVG UST —o1g Q: WAP 40 create 2- Dimenstond Array, 7 <2 php $arrsarray (doo + array (12,3), 20), echo ors Leo JL]; % ZF user uptood any file from Browser Fo server pirst phat file wit? Upload into server temporary Mem. 70007. We need to implement Servexside Script te move thot file Froro temporary mem, loca?t0 permanant yoca?”. Oped Fo Temporary rem, 10ca¥? #2 Saves phe File with Onother Name, x Elements of v ° P- Files contains 5 elements. Each elermentis: first dix? ts name of the uptood centro?. y Papers [Pomecrupoad con] ['szze/]* a : ~~ By usiog His @termen? we can Get me uploaded File sixe in Bytes. 2) P-FILES Lname ofupieadcon!]['pame’ a fo get the uploaded Filename 3) Fates [Nome of up?oodeon!] Ltype'] { MEME)! ar . To ger Me uploaded Filehpe, 4) P~ FaLes [nome ofupood 0] [rap n ]: > ; a 5) $-eresTinameotuproadcan Teron]. U're Temrerny Filtnam pei ULL Jervor': Hime of File uptoadi gy, jon: Tage ervey nol peibatte occured a? the CoeeceoeececoeoeceeooeeSooveve Sew w weve a Mime $ (mime stonde for Mulspurpose Inderned Plailing Extension) ay ts a type OF extension, Used to x'perr the files frm One Loca?” to another loca?. User elfck on Submit Buthon By clefauit FORM con x!ferr Bak Fexh Forma HTML data, Tp you quanh 40 mIperr another Forma? File, We ganeed ro SpectFy MIME Type OF tha? File. Some of the MEME types are? EXE? apprtcor/ocret ~ stream [nat forage Lire . EZ appricar?/ par R >

Fag condains "enc" type aptrt bute, By usteg this we can Specity The PILME %4y OF fnpu? File. ato ¢ This o By using this configura? serting ae can Specs, : the max filesize to prea gd & 4 >. 3) upload -tmp- dir ¢ , By using rhis congigurat? setting, owe can specify the y Temporary Toca?” for uploaded Files. ) The default Joca?? fs Pp Felder > ee Bo-Ave-2012 | $— FR 1Bs [upload conname ]ferror']: Super Global Yaviable ° By usiog his Gonnpigorenh Wecanger the 3} A Error meg if any occured at the rime OF file upload. v2 Ff the etbeho. ve Zero, fire # upooded successfutty, rp Ervo ¥ (1). One, File size ts rnax™ Han Server coffgusar” Sertioge value if Error is 2, 3 fis? File size 1s max™ than Browser Configurar? Ferriogs Natue. tf error is 3, There ts Some Niw Problem at the Mme Of File upToadss . if Error 18 4, User selected the Submit Burton wuithour ony file Selec $_ server: (Fe? Server cane gporat? sem) ; By usig this Super Globo) Variable, we can ger the jnForm? abour server § Browser styou wank to ger Server S/w, Server IP address, Browser Ip address etc, We can go for f_ SERVER. (#-staver['seaver. sorrware]) By using this ae can ger rhe sym inform? athat fs avafdable ip Webserver #— SERVER SERVER_NAME]? Te get the name of Webserver B- SERYeR|'sERVER_APDR']! 70 ge? Mhe LP address Of Webserver. $— SERVER['SERVER_ Port']: To ger the port no. of Web server, (Br defaur port no. is'80\) *ecocococeoccoooeocee : hy a $— SEAVER CREMoTE- ADDER]: By ay To grt ihe Zp address of Browser. » ge $-SERVER [Document Root!) By using Hnws Super Gelobal Vosvabie, we Can } Qe the document root of Curren? Berson? ) Cet Yxampe /hidocs ) y bed J_ SERVER ['SERVER. ADMIN'S . * t Te, Using this ove can ge? the Admin ’ Name air ue @) Server_name, & J - SERVER ['scazpT_ FLLEMAME! Ta ger the curren? Seripioome muith y Comprere Script Path. Ce: baaprer (hides /upload.p rp) ) > H $- SERVERT'REMOTE Port]! By depoure To get the port no. of Browser (4319) > ° A $~SERVERT'SERVER_pRopocoL']: 9 Togjer the protoco2 Infos? sho? We are > using to x1Ferr the data. Chirp /a2) of P-SERVERLIRE QUEST METHOD]: a Toger whe method wha? We are usiay to Zije 3° dota with the Browser and Server. Post) 9 AF-SERVERT Query. strana’): : To get the query stag Yatue x g_- server [REQUEST URE" To ger the Curent Seriptoame ith quecy orvigg value. H $-server['scazpr_ NAme']E $- SERVER L'PHP_ SELF]: By using a1 Element De cancger the Curveniy execuriey Sexiptname, A $~ serverl REQUEST TeME]! : BY using this Elemend we canger Phe diverd pime inform” of let Request, as Timestamp Value. x4- seaverlayy]! . By aston this element We can ge? the total No. gf query String arpurrente. cccceeccoceceoeooeen rages. pne ¢ <2pbp 400; echo Walue is ".$sno; % ty a Protocore? A ser of instructs 10 x Fers the data Be?” Browser § server. Protocols ore A*vided nto 2 Types Deny 1) Starefurk protocels and 2% Stateless protoccds. > 3 iystatefut Protocol: These protocols Cao maindain the Shae of Apical” > Means we can access the a2 prevrous Request and Response your from curren? sequest. do Kindows Appiica?? we are using these prokogole ex > 3 TePlZP, FTP ere. 9 2) Stateless Preteccis! . pealad yg asl eo These protocels cont mointain the srate of 9 Appricar® means we cannor Ge? previous reques? and Response vouer D From Current Request. So Web Apprica’s we ase usig these protocols Beoz, They don? Carry the previous peye values Phots ovhy the performance 8 ver fost. ss & brtp, hips, ere. The main Drawback of Sta?eless protocers 1s marnrojning the Stare af Appri'cay? 10 Overcome Phis drawback "Cea eares Genel} wos tntro duced. ooocecocececoooeos oow Qo ° e e ° @ ue a e oO oO e Qe o o A COOKIES & The state management obfech using te maintain the stare of Appia)? Cookz& stores the data in ctients mem, loca?®, These data we can access From any webpage within the Applica), CookLES Stores the inform? in 2 locar?s, Either Hard Disk or RAM Memory Locat? of Client System, CookzEs are divided into 2 Type: TT 1) In Memory Cookie. 2 Persistence Cookie ' Inmemory Cookie $ CSt»res soforn? to Ram) Tp we create any Cooxte without Explicit Expiry ba Comes under Inmemey Corie. Iomemory Cooxte stores he spor Th Clients RAM rer. loca?? and destroys the datq when user closed the BrowWsen ie FIO stores Raya DS) IF We Credle any Cookfe with Expricih Expiry re 2) Persi’stance Coox? comes under Persistance Cookie. Persichance Cookve Stores thedata ip Hard Pick and Deletes the Foform) when phe Lifetime Cooxies Complered. ET. Coojeze ? Px CooKee ¢ By using Mis Super Globo? Yartoble we con ge) the Value of ae By using Mis FO We can Create the Cookfes in php. Sl-AuG@-guag Cookies Stored in Browser mem. 1o0ca?” pats why We Cane? access the Cookies from one browserto another browser. Pucookre 3 72 2ccess Cookies are browser dependent Cookie: & Paget. Page: php. ~~ oprion—> privacy > S48 bY Recreading the cookie wiith comptered eterna 1299 > chow cane oo fee Histng oeties Solernet % f H Disadvanrages of cookies: — Exprorei? Tools 9 igvroch —omning eer View teas 1) Cookier stoves the efor oo” Prices Syst. thats why end Coo Aigaderere Phe inforrn” oR Clieo? can modiry Cooke. dara, ip qsorte ts Feua) Uemited arnt of data. in) Cowie ‘Cn Store only Tex data, Cw e Iu nwwy oe vo 2 3 o e e Oo °o Oo 0 Qo Oo o oe Q 8 ° oO www eoeoecococcoeeeoouveeeeuwsy . dben user gover Coonerted With Server, without Session_id, server A SESSLONS + Sess¥ons Can Store the dota 7m Webservex. This dota wecon access From ony webpyye. in the Browser. By ustng Psesszon, We Can creole F access the Sessions. H DiFkerences Ber? cookzes And SESSZONG, 7 coonses eEsszens, 1) CoOkKLES Stores the Enporm) 'p 1) SESSIONS Shores the dada in Chien? system, Server_ system i2) COOKZES Stores Timited amb of i) SESSIONS stores huge arnt of oro, dora, con Hy 1. inp coores “Stores omy Text N) SEsszons Cap store any type of dao. * data, I) Gorse? ore unsecured. MY SEESEONS care Highip secured. From another Poge- IF You Wont Fo access Hhe sesovns we need to inttralixe Me Sessions when the Request js Started, 8y DeFaurt, we Cannor access the sesstons of One paye By Ustog SESSLON- AUTO_START He con Tmiiolize Sessiong The Defoun SS eer Yowe 7% “Zero. By chorging i's volwe as ‘t', We can stord the Sessions When the request ts Started. Othemwlse use session start FuncHon ty SAAR We applica? from awhere you won? to occers SESSEONG. y Products: A Opesodg ? By using Phy? F ye can append Some Tex? 09 htint elements, $ CAdiva") append ( function Funst) te CF CHO) ICH ra"), va? ("!sco2t") K)sevipt) A cssee BY using 1s properdy we can apply Styler to Phe elemends, $ CHE"). co8 Ceotos", green") eS ww BE ~ oe we cceccoccocecooe@eocese ‘eld = “ hp :i|ocathes? [phpmyadmin TTeTorar nw O7nF989000600393909090909009 4 > 3 9X ) or Mysan tnterachion With Co eococeccececeao@e@eocvooe 28-9¢07.4013 (75) & My SQL + $S-serT.20r} A Php is providing Php_mysqds d72 Vibracy with no. of FUNcHonaires to Connect With PlySqt_dotobase- # MySQL ig AM Open Source relotiona? Dorabase Managemen? S480. Supporting Number of objects Uke Tobles, yews, ec. X MySQL Ys Frmplemented by Mysql AB Corporation 7 1995; Now, dh is Poot Ping bt Ovacie Corporation. + The defaund username of mysqi db te"r000" and #t doesnc? contain any "passwon Okec sels. # Qatabese = 4 Database fs a correct? of. dorabose Okjecls. Datobase we x using to maimafn fabies, Stored procedures, crc # Tabre? Table fs 0 cone? of Roms and Columns Promp) We can connect mir PySBu dara base through 9 Command prompt by Exeeuring MYSAL exe file MIha? Is ovoHobIe fo AAMPP/MyS8L| Bin Folder, S2/Xampo/m4 594 /bi0 » my sqrvexe -y reo? Cz /xampp/mysq/oinymysq]-exe —tYREDE create dododose dbnw), ™mysq2.) Create database done}: ™Ys%) Use dbne; ° mys. Use dbnad; Columns: Fields Aphymyad ein 2 Rows + Records His a Graphical User Interface used }O CoMNeECt With MySq? dalabare Sits available With WamPp download. The URL Oddress to OPED phpmyadmin Ze Imp sf lecadhost/ phyr admin, YSnser By using this opt'on qe can Ansel vecosds ty Tabie. 9 Brovse: ay using this option, We can Browse Phe Table Records. 32 Structure? To change the Structure of a Tobe, Sf U Wank te add nex Mécstths fields Aerere existing Fields, Add conshaints, delete constraints and ?o rename colemns SQL: By using this option We Can Execute ur SR Statements, Search by using this opHon, Me can search the Recerds in Ascen, a Pescending oxder based on ster columns (Columnnanes) ae ©} Sperarions? ~ By using sis option ale can change the Table ¢, 10 a nether dorasere de change phe Janie eoaine Gres” (*Btenam, Te move Pabte io | Tp Exporks Fite, document Te, By using this option We can Expor? do?abase Tables as soi pdf, ere File Formats. 2pdmpor : AL By using this option We con fmporr the exported File. A 3) Empty? By usieg tris optten, mie C09 delete the table Records 10> Props delete the Yable Structure pone ey using This option, We Can deep Hie Febte Strrcheee, A Mysan Soreract‘oo With PHP (a4 aan TET PHP SLO 18 providing php_mysqedi? Tibrany fo Connect With mys database This Vbrary ds Providing More Functions J) Mysql _ Connect! By using this P?, We can create a conn” Be? php PEG. Ond Mpeg? a, Sr compains 3 Arguments pServerName)puserneme, And it) Password. 2) mysp— select_db_= Ft nee oetect o db-Fr0m mysy? Stryey oFuMenis ore dartabasename ANd Connection td. 3p mysa— quer To emredt Execute 9 Sql query 19 Mp-S9 dotobare Aggnests ore Sq) Stot\ement And Cennection 74 re ore 3, A) myeyl_ error To Ger the Error Dessay & Fry occured ot the time of mys) stab Execuron. 8) mysqi—_errno: . : Ts Ger the Error number IP any occured at the Hime of roysql Sta2, ExecuP? x kK word Apteat Ti P, wt os cen, rcp = ae mone gor QScer tals PCfoon char? count (empid) From . A Large no Juin a Floating Dectral pt ? Tiger te chorocter fay Rate oy Vm) pecronay: Votue: “—==4 Double stored os a shring, Moning & oO fora Fixed Decirna? point. Fgelect char(98) SP sb oO 6 4 7 2 SI) pate 0 gat ‘et 2d 5 Gen the Remainder of Sip ralurg Lard a A +) pate yyvy~pim~pp 986 GONG LE setect mod (10,5) ofp: 0 e 2) : . (18) Adp! > DATEFEME PYPY-PIM=DD HAM oss Re By using is, we can odd com O 3) TEMESPAMP -YPFYMMDDHHMMSS dotes go sp dare: AY LEME HAIPAMNTSS giyat.gorgfeonatttcs ype neh, Ex: select ADDDATE('20r2 01-02", ZNTERVA yaa alexa. emnpapl? "gop = 31 DAY); Yon Supported nL? a A Luncrion Supported By Myse: LQeurdade,curetadale! o Ad Abs: 8 aie this J? eee using This Funelen Ne con get, the We Can re the current date inform? curtine, 4-199 Avsolurte yarue of Sip yolue. 17) current_gimec) Coonyents —value to +yali S To geh the Current, Y" val yaue § +value to value) ime snform? our? 43304:38 Be serect abs(-10) MP? to Ip Curren Virrestampo): > = — i Combing 4) Spe: SIN: sin F Current—date 4 Currend_timeWsed Jo 2 ger the wig wave oP Sip value, et Both Dak § Time form. EF serect sin (0) B ATsetect curdaret EE setect sin cao) 4p! O89s9geoe360056 I) Sc? Curtimeg? wet = : a nL SeIEY Current Memeslomnp 2h-12 D> 269289 _o 23) PADS Cotessoge Pygest 5) i (9) EE 27 using this 29, we con Conyerd He Sipvatue as 32 JA AuGUsT Rosy” é — characters lefts alphanumeric SIE ex: Serech MDS ("Sco") OZocraalg Found? geunds a OF Su set Cisco) 03-01-4018 is 0 Floating point number to ii $ Select round (10.40) - 7 Sereck round (10.99) ¥ € Floor: Select round C1o.50) oder at . 5 By vbing Hide F aie ey rounds a Floating pont number 20 THs Ps nearest Fodeger Value Frowo: 4 ome as current timestamp, oO 5 Nearest lowest integer volue- Bx: setect Floor (10-99) OP : 10 D5) cen ceiding? ° Rounds 0 floating point Pumber to IP's neavesd hihesd integer value ° Ext # sum: y can ef) (10,40) . ! 9 ech eR C8) APT 1d =" te get at Reeerds of 19> Yang: Specified ce lum. yf Select Sum (empid) From emp Returns a random number bel? 0 onds. £4 OIP : 0-58637--- * Ex: select rand ° we wf 9 Smin: o io a To get minimum Value from group of values , Te get the power ofsie 2 Ex getect min (sno) From Hbl_ user 8 Select pov (2;2) og erect min Cempid) from emp 1:4 a Te get max” value from gror of values, Ex'seed max (empid) From emp 9 029 Conca: Tel peymeraiey two ou yatues. Ex seleck C00: / username) from Joo-User Op t Oy Select cnet ener) pwd) from new—bab one | EX! Seiect Cencat (" Score", "Smith", To hn a ! 2) THartenam, CHARACTER LENGTH f ; 8if! scott smnthzobn | 5 By using Hts 7, we can ger the ord) | o Number of Choracers of a ating. { a pees arecr chor_ length (uname ) from ned—tab SIE * | on eva SEE CHARACTER... LENG (*NELESHY) oe: a: verse = . ~ ca wis playe the string in Reverse irection» | 9 oglt! Select reverse (*Seort*) OP: toes i 0 ys | Tay Substring ! | 9° due get the subsiripy of 9 strtoy contains 2 Gyguments . | ° first choratker number § second fs Tata? number of, chordder | oS — Bai Seeck Substrt Caen 12,3) CHB? Com Vv = “Select Si Welcomes, 44 ; o%e cacsn Cepebic Redand ney theek)'® SIL! Come °o By using this £9, ue can Convert the Sip Shing at BL Ex: Serect creB2("scorr?) OP? Bit Enceypted Nameric ereapoiiges “Imggiie Volut ° o fegyem is echo #con 2 emgea carech“Locathest «pose, * *), - 2 shimano | % Erercen tear ey ; Program: 2 ape sg Seay, Clee echo mysterrorcy F 2) ZPPHP else > echo mysgl-evror(); - % Pragrarn:3 <2 php $moets mysql- connect (‘loca}host*,"roo?"," "); mysql - Select_db ("bes?”) » $dora=mysqi_ query (“select # from Nev. ab"), chile (f rec =rmpsq)_ fetch. row CFdora)) if (fno%2 ==0) eae f cotor -"jghrbhue’; pa mmaae! hee s"ghygeress fo: Seam 229 germ got; €cho "tr Siyle = "background cele 2 colow >"; echo "Zrd> gree LoI< td > ff rec LAT <2d >g rec(2q"; Father: Remdars siggh ) Brmysigh | 810.9332193 Plob Not 1 Clo gong dev? Noyee Dadhi Run - r Karvate, chanduats’, Up. | bttp:// Joceulhost/XYZ-PhP * nn | Dob: BE oF 06. Apritsses Provethas@amey coo rabulpandy, 19 gm hey Database Engines in MyS@l? Dovabase Exging, Sup ee aces eS a A pb is engine As Gb! Undertying Progeeam usiog 70 Yun the Bq) stotements in DB ronpuages DiFp Hpes Of OB Engines are SUD A’ Ditferent Types OF pe egines 4) my'sarn: Sr is a default Boas engine Supports mysql, every hable bp depaurt Creddes mnith this Engtor, Sp We create any Toblenithmytsom Engine, Screctes & pies jo Mainrato The Table Jnform? The filenames are Same as Table nome Contains dipt. types of Evlensions " rm This mension file motnaine Fable format Wd novidotns Table Dato, sa) amyt? Yee Zt maintaing Table Sodex An These files are avetlable in pata Forder of PrySql folder. merge 97) Stat. to gucote table wih sam Enging erate table th1-Newdt (sno tor) engine = mytsarn Create lable This Engine does net support Relorionshtps be}? the Tables that's we don't comptes a br Erier prise Devel Appricdis use his Engine oi 457 We con nor get Phe data back easi?: 7 ih) Fs Faster of the time of Redvfeving dag. But J? 7s Slow While Tnser og acs Updering dda. Gf databose server ts crashed rs ‘DS Tanove: us DD, 78 Pepnsacr” sofe Eine Supports the Relationships Be? ne ables. Piawetat commie ji) These Tobles We can used te develop EMieprise Yevel Appiica”, This Engine Supports he dota Recovery ophion, H rhe dela base Server Fe sy. Sb w very Faster ap the Hine of fsertit F updating “fhe Records. ¥) we can easily retrieve the data back, if Ab server 3s Crashed Create rable Aibeapesd Selec? * From Fb_user Mimi? 0,2 ones Vi) Select * From 3b) _user suhere uname ke toy! bp-INsear : By using this spatement, ove con insert Records fo Table. &s Th sert tb1user valves (123, 'abc’, 'abe!) ii) Fnser? Pel_user Gye) Values (1254) yp inser? inky Hb] twer (vd@me ) yolues ("smi rb') iy Insev? th1-user vo)ues (123, 'abc', “abe! ) 4 4 ) Insert smo Piluser values (100, ccor’), Cone, Sno A mysq2_ num fietds (Resurrse?) eemaaaiox — By Fields (taata),, ? By using this FP ove can ger The [otal Do. Of Resunrsert fields. exec Ceuvouwss ae 7 Coesultsed, PreldZndex Number): # mysql prerd roy hie toe can ge? te name of a fied droma ResuTtn! ? c The Arguivents are resurestt, MedEndernumber 3 Ex g i Gost (4-posr ['sub]) Table nome? 4 ' °o mysql_connect (“locathost” , "soot, ©"): chen» mysq_ select db (Vest); . ° Searas mysa?query (Selec? from ftnamé), ° fre =mysqr num_fierds(tdara) ; eS for (fisoy gyxgrey fi) Ee Date GH 08-007 2013(67, - By using this F 2e can ger the Toto? No: of Records from mysql resuttser?. Condotos 2 axguments Name of Resutiset ond > &: Q < tebe mysqr. connect (“localhost "root," "), fa Myeqd — Select oth C'est"); ? $data = mysql query ("Setect From Fb1- user"). frec = mysql- Perch. assoc ($data), oO MI privt_s (freo); ceho frecluname’], 9% 0 © k my sor : a DESK fetch arvoy() og the records from reeultse? & retums Phe Ofp as ° both numeric Arroy § assoctabve arrof, $1. ¥s A combina? Of MySp_Ferch_.rewl), Ee: © EM ferch-o8S0cc ), tammbatin griabomamie” s99.q = mysql query(Sereck Prom PaTvee ree =mpsq-Ferch~ array (F422), . 4) Prior Chrec), © A MSN _ ferch_ object): © SE Reods @ Record From ‘Resunrse? § Returns Me Ofp a? an objet This object belogys te Base Class tes be Mdaiues. StdClass. Be Frecl2] previoue ", froextinder » {sinder ¢ $ totrecy IP Cfnextinder « $tabrec) 22h Ka hrefs ‘prog: php! q3= $nextioder') MEATCIA)'s PrIdK a (MY eq). PPh AIA CPdara)) ey Vw Ow we e ceoocecceccocoeeaouceo e o oe ° OP mys Qarist— dbx): pa eoceceaecce delete? © ame Oy using this sta, We Can.delete a Record or Set of Records Frm q Table. bx: = delete from bluser where 9n0= 1005 updates wee re update the Records of a Table. £2) update Hoi-user 36 uname s!ecottsas! Where sno=10 i) Update TbI- User vet Unames ‘Scot? 123', Pwdelabed' Where Sno=10; POL statements < — By using these stat. we con desine the Shuchure of dorabase Objects, To create, alter, drop ete. we can g for Et PPL stalements , 1) create? QF-0cr to13 ———" by using this statement, we can create OB objects. Extincreate user gcott@locathos? Uy creme user srmth@rocathos? idemipied by *srmdh sss’ are aya ab 2) qrrer! Benet By using this statement, we Can change the Structure of a Table. fn Evatier tabre“tbLnew add column uname va¥chor (100) Adv Wabie Heisogiarrer table tno add columo address Yorchor(too) First 2)dFop : Datter tanie $61 new add Colum gddyess4 varchar (tee) afer 999 By using this Statement, we can drop dh objects THke table, user, ete. We can a8 drop the lable Columns i drop rable 1b1-new A) truncate? dtrunccte: By ustag this statement, We can delete the an Records of Fabre. BE buncate table Ptneo 5) yename? iename! By using this option, we can chonge the table name. Tename table PInew te abed This f? Returns rst of databases a8 o Resuttsct- Be Parabases :X select nome = "depdb") ¢dbL0] 's else echo "Kopriony $AbT 2] freaLe J Kleptnny' , To get the 138% of Tables Ayarlable in mysq) dolabase. @ oes ooececceccoocoeooces else | 4% ", $ Fo Emysql_num_piads Cfdarq) forCHiz os $i $ree ley"; , “input pes "submibY value: “Ged Records! Mame:'subz” £23 Kf rhp Y Gisset CH post ['sub'])) Ptname = 4_posp ['txrtable]; mysql connesC"ecsthor™ *roor', *"), Mysa). selecd_db ("test"); Fata: mysp_queny ("select » from frname, abo "; i} t “Crore rerhed: "Post" actions! © > Table name : ease background = cote: airyenion; cithin Be some Vx ) “onmouseover = !apph shy ecpnis)? > Pshyle-background Color 5 "TgghhyeToH" Sree rae ‘fortor’ Inpur-ypes'cheekbos Function removestyles C8, co?) # ; D2 For (is03 F 9 function fun) (sne) > . w “My qt refpe “pt Vicks" \* 4 location «"Batiphp $e: 4.9n0 Sabre o. oneick = 'chkpun trues’) 3 . eek A eater Spdsp < Jay o A program to delete mutripre Records. Y B® 2 ot 9 8 ecarion 2!detiphp?! +30 ° © La hrepa"g¥ onety O onclick = "Punch (Fale) >Unches an Fes=$_SCAVER [AVERY STRANG'], PMSA. cooneed ("cathe "root, * *), THEA. Select db (Mesn"); ™MYSEL. query (tdelete From tbl. city where cide pqs"). header (loca?en seb: php" % ig? Ds y Aaah B . Pfermy epeteie" fd If lmrysqd_query("inser? iodo tbIvser Jorues (‘tunome’, 'end')")) 7 echo "Accoun? ts Created"; 9 in 4 > |YCmny eq) _evrnot == 4062) » echo "Username #3 already Registered”, else echo mysqletrore), oe a AB-0cr 201g Rep-pho <2php 44 Cisse? (p_post ['sub'] )) funome = p_post [!P@uname' ]., $ pad = post ['txtpwd'],; femaid« $_ post Lreemoit],, fend: "abc". pad. "RBH $pwid = shat (mds(fewd)); mysql. connect "loca host" "voor," "), mysq_ serech..db (*test"); IP (ranyoql query ("insert into MHL. user yalues("unome! fond, \Bemair’, 0)")) f¥@ ndno = rand (1, 1000),- $a ndno = guname. rondno, ME Q2 quer (“inser Into WLactivotion values, Bars cceohe Rei stration Competed Succesepuly to acHve Ur account click 00 C'funemes $rondno )), —— —~ Ema: ~ ¥ o Aictivole. pho: <2php $99 = $reQuest Lio], mysql_connect (ocadhost ";"root",” "), Mysql _Selech_db ("test") Fdarg «myoql_.query (‘select Uname From 24) activation KIhere acode =" pqs" Frecsmysql-gpich_ron (fuera), funame= $ree Lo], MEG —query (‘Update Must Se adtivest Where vNaMes 'funame! " ), Echo “Aciivation completed Successful"; %) Logio- php ), Lpdore. phe $v 2 Sites > fotne dete." fy! SECfil= Peover) » sts", 9 uname $_ Se ssz0n ['ouo'], 3 fistr.= "where uname='gyname' " Ty 3q1_ connec (“locathos}","so0r’, * ¥)» _ enysq)-setect_db ("ea}"), a roysfl.queyy Cfste),, 3 header ("location: get pho"), o ® e o Oo ° Q 0 9 o oO ° ° ° ° we Owe VU D. Updore. Lhe 2 session_start 0); © F499 =$_sERVER[ QUERY_STRING; © 4-5€8SI0 ['oun']= $98; ™y69)— connect (loca? hos?’, "root", * ") m™mysdl — Select_db ("test!) , Archive: ° Emay ! mysql ctosec; mysql_seleck_ab C'est"); % Aetna? _— By usieg foins we can gecords From murripie tebies bosed on Cond’s. TJotos the mainly divided fnrto 3 Types- . . dy Enver Join 2) Outer To¥m 3) Crvs9 oF ene Sin Carresian Tein. 9 Mu Ieing 7 Inner ofp 1's qgain divided fnito 5 Types. I) Equiv-yoin, by Non Equiv Toin ¢) Self Jetn. ) % Equt fen? 2 Hf LV want the records from a particilar Table, based on € qual cond”, comes under Equr—foin. , Ex%iyserect ernp.ename, dept: doame from emp, dep? Where ernprdepnoe _ og dept. deptno £9 sezect empename, depi-doome From emp Foner joo dept 2 emp.deptnes > oR deph depino 7 Using togkrdoin CSPeed cal fi0Select eename ,didname from empe, dept d whee edepinveddeping "70 . S using Miatorn, & 6» Non-Egur Jorn ¢ g Bf v wont Yo get The records from mulbipte Tables withoit v oe Equi Cend?, wre can ge gor Non Equi Sofn. 9 aa °o ext = sereer ename, sigrade From empe, salgrade where exsol bePtoren Wow $a S.hiph: g Ste 4% and S-highsel o Serect Cename , s-grede From empe fnner join Sayrade 9 0n ErSdr bekDee|D %Lowsal and 9. hegheat. oO 72 Sag iste agi? Uv Nant ro get yecords From single ‘rable usig con ds, we can - 9° fer sey tein. s EA select evename as Empleyee, miename as Plangger Prom empe,enp ™ 4 ‘where eo mgr zm -empid my a VIG oOovudsyve ececeooococooceocoaeec ee ove s Select distin mename as Plangger From emp e, empm cohere exmgrernrd & Select rmeename as manager prom emp ¢, Where €-mars m.empid. X Step cer eoemp; Aik eh Lem desk Select €-ename, C.cname,d.dname From empe, 1.cIy ¢ ,deprd Shere esdeptno =d.deptno and escityids ectd. pce St select e-ename, C-Cname,d.dname From emp e_foin dep? d on esdeptno ed. deptno fon thl-city ¢ On evcityid ecierd IL) Outer Join! To pet the matched Records From one Table Marching and Unmatched Records From another Table, Ft 1s divided into B Types @) Lepr Ourer Soin ? Quis Jem Te ger marching and Vornadchipg records From LHS Table, Matchiey Records from RHE, Ext select e-ename, 4: dname from emp e le? outer _soin cep? d Op =" exdepine «d+ depino. by Rayne Outer Torn e To ge the matching Records From Hs, Prarchiog g Unemarching Records from RHS. BE gerect ©. ename, d.dnome from emp e Teybt ourer join dept d on e-deptno = deptno C} Furr outer fotn? 7 fr #9. combina?” of Left Outer Join § Réphe Ourer Soin, usteg an Union ‘keyword, We can combine these 2 Joins. Be select e.ename, d-dname From emp e€ left ourer Join dept d on erdeptnn =dedeptno unton select e-ename, dsdname From emp e Tigh? Curer join Hep? d on e-deptng = dsdeptno- SS b Chose ok Cartesian ei Boer tore UD bo ger the Records From rounriple Fabres Without any cond? This join we r using Select » From emp, dept Feed Ore 18 @ Virtucdd Table of Physical Table. Views we 7 ust 9 to Can the Common columns Moof Hmes from q Table, ~) Views wer vat to coil the columns fren a fable. Instead of ust as murtiple colle of specified columns from a a We con ge fOr 9 vad. + ‘View doesn? cecupy Memory, Sr contains Select stdtemen? for every C927 of view! gers the Records from o Table. > > 3 4) Simple View Fp We Create ony View by gertieg Me records fray Single Jable comes under Stmpie view. we BE create view ywivieDL a4 Select empid,ename, 901 from emp a, Create yied vu views as Selec empid, a9 "Employee $4' ename as lEmployee 2 2) Connphey Yiew ! Name’, 901 from emp_ 3 =— Sp we Creche any View by Getting the Records From muniple 2 Tables Comes under compley Views. o bes a Create view vw-Views aS Seleck e-ename, €-Sa2, e.cityid d.dnome from om eG cep? d duhere e-deptno =d:deptoo e 3) é # Order By? ° By using this HibeHege Class We Can Change the Order of yable While (Pree smysq2_ Fetch_raw (Pola?e)) echo "<479<4) tree Lo <1) frecl2J", ford ="desc"s else ‘ford="ase’; t eA Recerde. awe can get the Records To Ascending Or Descending order by using Dhie ac EE select * from dept order by depino asc 9 Select # From dept order by depino dese Q : ; e A: By weing php? r iC g ee mys q)_connecH("2oca? host”, “root”, " ""). Q
a “4 php mysdl - selec?cb (ade Pes?) ° ip Cisse? CA_reguesrl'ys'])) Holy = M891 query ("selec From dep order ford= B_reevest(9s'],- echo “ehhy < neh a ford’) , : rise » Ka heefs'osdsphp? qs = £ard'> Deptno-cjay" fords £rdesl ; ©2b9 “ethy Dephnlame'; A_Sq) sopectten: AEs OCT gosa ° Sql injection js the concep? of Passing Me sql Stabements to the S)p Conrels. J by othe User. User Can pase thi't Sql Statements +0 hack the informaion » From a Database 2 User can execute Met onIN 8qi Stdtements 10 get The Informa?” From ab af a Serter, Add the username and passwords, Aeaviave the DB Inform? otc, a Desjroy User wyi2) Use F/p Conrrods, querzorseg, Ete. 76 Hack the TAJorm From pA. ser WIT Use Some Specie? charactera He pase thelr sq? Shaiemen? thr the Sip combrers. 1S provide security fo me Appiica?? we need to FoNew Phere steps Don’? Accep> rengihy Sha}. From user, Mr the Sip controls 4 z i Use SavaSerip? Validation to check qlhether User t's po: ir. the Sip controls . 3: Used addslashes, pur the backolashes to Poor of stope § Double Quotas Re can also use Mysql_rea?_escape— string, to pur the 2qt slashes To fer of single and double quotas. Steet s a Snyarid Characters : Use magic. guores_ape Conpfaurav” seiniy,. Sh fs used Po pur the 2s Backsigshe? infrant singteand double Faro?avs, The Yalue Should be "ON Cong jquras® scbhg | magic quores geez ON vnecocueroceeceoce@eo c coho " Connected, ae Usennome : — erve passviord
echo "Nor Connected" , . ‘ Jodabase Pessword; Cinpur dype-'Passwerd! nomes! pwd!) yom — 8erecd_db C'mocter). name 2
Fddlaemseq?—query (“erect * from O. as bezio 9q2 stad sq) stad. end To cant the store procedure from mysq? we should use mysql” Mbrory. derimiter fe clear Mem. Busfer ) Ee a. "9.To See Kecoras Ney), preyjour php ? on eeting Net and previ S€I9S100_Start( ). % ; Burton.
", fpiod sping — plodrec; 1£ C$ pind >= =) nage: echo "Ka hreq= Bip php ind =p ping * > Here NEMT<109", % SAVE AS: PrenxiRec-php Stes 0% Borocr gash? Eo) ° oocceccocecooceoeocog _ A Peg P8P Regrotration Form with cheek Arai abit, Yalideion & noscript) Xmerq hrtp- equiv = "Vefresh! Content ="of ‘error. him ")