Ifyouappreciatethiseducation, pleasethinkaboutgoingtoElithecomputerguydotcomandoffering a onetimeormonthlyrecurringdonation.
Welcomeback.
Asyouknow, I amElithecomputerguy, andintoday's clients, I'm goingtoshowyouhowtocreateanHTMLformsothatyoucanservethroughyourrecordsandyourmysequeldatabasetables.
Sobefore I showedyouhowtocreateanHTMLformthatallowsyoutoinsertrecordsintoyourtablesnowwe'regoingtouse a formsothatyoucansearchthroughthoserecords.
Essentially, whatwe'regoingtodoiswe'regoingtocreate a formthatwillallowyoutoinputwhateveritisyou'relookingforthatwillthenpasstheinformationto a PHPscript.
PHPscriptwillthengo.
It'llservethrough.
You'remysecretdatabasetable, andthenyouwillthen a printoutoftheresultsthatmatchyourqueryto a basicHTMLscreen.
I willtellyouwhat I'm goingtobeshowingtoyoutodayis, uhreallyishell.
It's gonnabeugly.
It's gottobeugly.
I wouldnotsuggestyou, uh, youhandingthisoverto a user.
But I dowanttoshowyoubasicallyhowyou'reabletouseHTMLPHPandmysequeltonowbeabletosearchthroughrecordsandthenpreabletopresent a resultin a Webbrowser.
SohaveAh, I havesomeTimmy's and I have a Jimmyright?
So I canputin I amandwhy?
Andsince I hadthatpercenttosigninthebeginning, thentheresultsthatwillpopupisTimmywillpopupandgivemewillpopupandbasicallyanynameswith I andwhywillpopup.
Sothisisoneofthevaluesofwildcards, andsoissomethingthatyouneedtobethinkingaboutwhenyou'recreatingsearchformsbecausepeoplewillnotknowexactlywhat a plugitagain.
Ifyouthinkevenyou'rethinkingabout a namemakingsureyoudon't misspellit, makingsureyouknowenoughisittobeesorone B?
Isit I e.
Orisitwhythingslikethat?
Ifyoucouldjustplugin a littlebitof a snippetofwhateverwordyou'relookingfor, thenyoucangetalltheresultsandthengo, Ohyeah, that's theonethat I'm lookingfor.
I havethatrunningwithin a virtualmachineandvirtualboxand I havethisonmyMacbookProYoubunchofdesktop 18.4 I didusesomethingcalledTaskCellinordertoinstalltheentirelampstack.
Ifyoumisspellsomethinglike a tablename, thatcouldbe a realproblem.
S o Thetablethatwecareabouttoday, though, isstudentsThat's we'regonnabesearchingthroughcertainusedescribed E S C studentsverifywhattheschemaofthistablelookslikeonDSOfortheschemeofthistable.
Wehavename, age, genderanduniforms.
Sothesearethecolumnnames.
Wealsohavestudentideahere.
Ah, student I d istheprimarykeyandit's theautoincrement.
Basically, all I use a student i d.
ForSo I haveanabsolutelyuniquefieldforeverysinglerecord.
Soevenifthenamesarethesame, eventheagesofthesame, eventhesexiest, sayingatleast a student, I d willbedifferentsotheydon't runintomajorproblemsotherthanthat.
Again, wetake a lookatnamethatis a textlookatage.
That's anendlike a gender.
That's a textandwelookatuniform.
That's a texttoday, thefieldsthat I'm goingtobedealingwith.
What I careaboutisname A andgenderpastthatjusttomakesuretherearerecordswe'regoingtoselectallfromstudents.
JustseewhattherecordslooklikesemicolonAndokay, sowecanseethatwehavegot a lotofrecordsinhere.
Themainthingthat I'm lookinghereforisthat I dohave 19 recordshere, so I havesomethingtoplaywithagain.
Yeah, youdon't wanttoruninto a problemwhereyoursearchformisn't workingbecauseyouhavenorecordstoCirqueagainst.
Sowenowallknowthisishere.
Solet's goandtake a lookatthefirstMakethemlformthatwe'regoingtobedealingwith S o.
I havecreated a formcalledsurfdothtmlonifwelookhereagain, thisis a very, very, very, verybasic 80 milforsowe'regoingtoopenupwithanHTMLtag, thenwe'regoingtogotothebody.
Soopenupwith a bodytag.
We'rethengoingtogodowntothefour.
Soweopenedwith a formtag.
Wegivenanaction.
ThatactionisthengoingtopasstheinformationthatwecollectheretoPHPuppercase s sosearchdotPHP.
Sowhateverinformation I gatherhere, thisisgoingtobesenttothisparticularscript.
Theinputtypeisgoingtobetextandinthenamesothatwecangrabthevalueandturnthatinto a variableinPHPscript.
Thisishowweidentifythisinformation.
We'regoingtocallitsearch.
We'rethengoingtobreakbelowthat.
We'regonnahaveaninputtypeofsubmit.
Sobasically, thisissimplygoingbe a submit, butinwe'regoingtocloseourform, we'regonnacloseourbodyandwe'regonnacloseourhtmlIfyougooverandtake a lookatwhatthatjustphysicallylookslikeGoto 1 27.0 point 0.1 forwardslashthatPHPfolderthat I talkedaboutbefore.
Forwardslashasser a searchduh h t m elseandenter.
Andsothat's whatthislookslike, right?
Soagain, we'vegot a a horriblyugly, simpleform.
Sohereis a search, right?
Sowegotcertainfiguresearch.
Here's a textbox.
There's a textbox.
Here's thesubmitbuttonhere, andhere's a submit, butsothisissimplywhatthislookslike.
Itis, Yeah, reallyuglyfromthat.
We'rethengoingtogoandtake a lookatthePHPscript.
Sothisiswhatactuallygetsinteresting.
SoPHPofourcase s forsearchdotPHP.
Sowegooverhereandtake a lookatthisscript.
Thisiswhatwehaverightonandlooksverysimilar.
Thio, whatwe'vehadbefore s sothefirstthingwe'regoingtodoiswe'regoingtoopenupthePHPscriptthenfromthat, whatwehavetodoiswehavetocreate a variableandsetthevaluetothatvariables.
We'regonnacreate a variablecalleddollarSignsearch.
I cantellyou, withsomebodywhoscrewsaroundwith a lotofcodeisreallyfrustratingtositthereandeditthehelloutof a particularscriptandthencomeupwithmistakesbecauseyouforgottoreferencetherightscriptinthefour.
I wouldrecommendthatyoucopypastethecodeandthen, like I say, playaroundwithit, seewhatyou'reableto d'oheverythingthat I'm showingyoutodayandmanyoftheseclassesisveryugly.
We'renotusingCSS.
I'm notputtingin a lotofformattingoranythinglikethat, because I wantyoutogetthebasicconceptofHTMLPHPandmysequelwithoutgettingintotheweeds.
Soagain, likewhenyou'rethinkingaboutprintingout a record, youcansimplyprintouttextlike I didondifferentlines.
Butasyoucansee, it's notspacedverywell.
It's kindofhardtoread, sosomethingyoucanthinkaboutisokay, well, maybewhen I printthisout, alsoaddthecodingThiotocreate a tableinHTML, andifyou'regoingtodothat, maybeaddsomecolor.
MaybeKingfoughtsize, youknow, playaroundwithit a littlebit.
Sonotonlyareyouprovidingthetechnical, thefunctionalresultstotheenduser, butyou'reactuallyprovidingtheresultsin a waythatiseasyfortheendusertounderstandagain, asalways, I havesomeoldtimersouttherethatareCampbell, a mainatthewaythat I'm showingyouhowThiocreatetheselittlePHPscriptsandinteractwithmysequeldatabaseisnot a goodwaytocreate a codeforproductionenvironment.
Andas I willsayagainandagain, I agree.
What I amshowingyoutodayhaspisspoorsecuredagain, doesn't haveverygoodformattingwhat I'm showingyou.
Soasalways, I enjoydoingthisclassandlookforwardtoseewhatthenextoneapparentlythetypeofcontentyoujustsawisnotwhatSusan W.
WantsforthefutureofYouTube.
ThismeansthatrecommendationsbyYouTubetothischannelhavedroppedmassively, andviewsarebecoming a comicallysmall I hatetoask.
I usedtosay I wouldneverask, butifyoucouldsubscribelikecommonandmostimportantly, sharethevideosthatyouappreciate, thatmayhelpslowthedeathofthischannel.