欢迎来到天天文库
浏览记录
ID:9301892
大小:52.00 KB
页数:10页
时间:2018-04-27
《外文翻译-accessing mysql using php通过php访问mysql》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、毕业设计外文文献原文及译文AccessingMySQLUsingPHP通过PHP访问MySQL计算机系学生姓名:学号:计算机科学与技术系别:专业:指导教师:2015年5月AccessingMySQLUsingPHPNowthatyou’recomfortableusingtheMySQLclienttoolstomanipulatedatainthedatabase,youcanbeginusingPHPtodisplayandmodifydatafromthedatabase.PHPhasstandardfunctionsforworkingwiththedata
2、base.First,we’regoingtodiscussPHP’sbuilt-indatabasefunctions.We’llalsoshowyouhowtousetheThePHPExtensionandApplicationRepository(PEAR)databaseunctionsthatprovidetheabilitytousethesamefunctionstoaccessanysupporteddatabase.Thistypeofflexibilitycomesfromaprocesscalledabstraction.Inprogramm
3、inginterfaces,abstractionsimplifiesacomplexinteraction.Itworksbyremovinganynonessentialpartsoftheinteraction,allowingyoutoconcentrateontheimportantparts.PEAR’sDBclassesareonesuchdatabaseinterfaceabstraction.Theinformationyouneedtologintoadatabaseisreducedtothebareminimum.Thisstandardfo
4、rmatallowsyoutointeractwithMySQL,aswellasotherdatabasesusingthesamefunctions.Similarly,otherMySQL-specificfunctionsarereplacedwithgenericonesthatknowhowtotalktomanydatabases.ThereasonforusingPHPasannterfacetoMySQListoformattheresultsofSQLqueriesinaformvisibleinawebpage.Aslongasyoucanlo
5、gintoyourMySQLin-stallationusingyourusernameandpassword,youcanalsodosofromPHP.However,insteadofusingMySQL’scommandlinetoenterinstructionsandviewoutput,youwillcreatequerystringsthatarepassedtoMySQL.WhenMySQLreturnsitsresponse,itwillcomeasadatastructurethatPHPcanrecognizeinsteadoftheform
6、attedoutputyouseewhenyouworkonthecommandline.FurtherPHPcommandscanretrievethedataandformatitforthewebpage.MostwebsitesdevelopedwithPHPcontainmultipleprogramfilesthatwillrequireaccesstoMySQLandwillthereforeneedtheloginandpassworddetails.Therefore,it’ssensibletocreateasinglefiletostoreth
7、eseandthenincludethatfilewhereverit’sneeded.Example10-1showssuchafile,whichI’vecalledlogin.php.Typeitin,re-placingvalues(suchasusername)withtheactualvaluesyouuseforyourMySQLda-tabase,andsaveittothewebdevelopmentdirectoryyousetupinChapter2.We’llbemakinguseofthefileshortly.Thehostnamel
此文档下载收益归作者所有