Table126headersalreadysent

headersalreadysent  时间:2021-04-12  阅读:()
PracticalPHPandMySQLWebSiteDatabasesASimplifiedApproachAdrianW.
WestPracticalPHPandMySQLWebSiteDatabases:ASimplifiedApproachCopyright2013byAdrianW.
WestThisworkissubjecttocopyright.
AllrightsarereservedbythePublisher,whetherthewholeorpartofthematerialisconcerned,specificallytherightsoftranslation,reprinting,reuseofillustrations,recitation,broadcasting,reproductiononmicrofilmsorinanyotherphysicalway,andtransmissionorinformationstorageandretrieval,electronicadaptation,computersoftware,orbysimilarordissimilarmethodologynowknownorhereafterdeveloped.
Exemptedfromthislegalreservationarebriefexcerptsinconnectionwithreviewsorscholarlyanalysisormaterialsuppliedspecificallyforthepurposeofbeingenteredandexecutedonacomputersystem,forexclusiveusebythepurchaserofthework.
DuplicationofthispublicationorpartsthereofispermittedonlyundertheprovisionsoftheCopyrightLawofthePublisher'slocation,initscurrentversion,andpermissionforusemustalwaysbeobtainedfromSpringer.
PermissionsforusemaybeobtainedthroughRightsLinkattheCopyrightClearanceCenter.
ViolationsareliabletoprosecutionundertherespectiveCopyrightLaw.
ISBN-13(pbk):978-1-4302-6076-9ISBN-13(electronic):978-1-4302-6077-6Trademarkednames,logos,andimagesmayappearinthisbook.
Ratherthanuseatrademarksymbolwitheveryoccurrenceofatrademarkedname,logo,orimageweusethenames,logos,andimagesonlyinaneditorialfashionandtothebenefitofthetrademarkowner,withnointentionofinfringementofthetrademark.
Theuseinthispublicationoftradenames,trademarks,servicemarks,andsimilarterms,eveniftheyarenotidentifiedassuch,isnottobetakenasanexpressionofopinionastowhetherornottheyaresubjecttoproprietaryrights.
Whiletheadviceandinformationinthisbookarebelievedtobetrueandaccurateatthedateofpublication,neithertheauthorsnortheeditorsnorthepublishercanacceptanylegalresponsibilityforanyerrorsoromissionsthatmaybemade.
Thepublishermakesnowarranty,expressorimplied,withrespecttothematerialcontainedherein.
PresidentandPublisher:PaulManningLeadEditor:BenRenow-ClarkeTechnicalReviewer:AndrewZackEditorialBoard:SteveAnglin,EwanBuckingham,GaryCornell,LouiseCorrigan,JamesDeWolf,JonathanGennick,JonathanHassell,RobertHutchinson,MichelleLowman,JamesMarkham,MatthewMoodie,JeffOlson,JeffreyPepper,DouglasPundick,BenRenow-Clarke,DominicShakeshaft,GwenanSpearing,MattWade,SteveWeiss,TomWelshCoordinatingEditor:KevinSheaCopyEditor:RogerLeBlancCompositor:SPiGlobalIndexer:SPiGlobalArtist:SPiGlobalCoverDesigner:AnnaIshchenkoDistributedtothebooktradeworldwidebySpringerScience+BusinessMediaNewYork,233SpringStreet,6thFloor,NewYork,NY10013.
Phone1-800-SPRINGER,fax(201)348-4505,e-mailorders-ny@springer-sbm.
com,orvisitwww.
springeronline.
com.
Forinformationontranslations,pleasee-mailrights@apress.
com,orvisitwww.
apress.
com.
ApressandfriendsofEDbooksmaybepurchasedinbulkforacademic,corporate,orpromotionaluse.
eBookversionsandlicensesarealsoavailableformosttitles.
Formoreinformation,referenceourSpecialBulkSales–eBookLicensingwebpageatwww.
apress.
com/bulk-sales.
Anysourcecodeorothersupplementarymaterialsreferencedbytheauthorinthistextisavailabletoreadersatwww.
apress.
com.
Fordetailedinformationabouthowtolocateyourbook'ssourcecode,gotowww.
apress.
com/source-code.
Idedicatethisbooktotheopensourcecommunity,withoutwhichtherewouldbenoApache,PHP,MySQL,XAMPP,MAMPP,EASYPHPorphpMyAdmintowriteabout.
Becausethesoftwareisfreeandsupportedbymanyforumsandlistsrunbyknowledgeableenthusiasts,thereisnoobstaclepreventingme(ormyreaders)fromlearninghowtoproducedatabase-drivenwebsites.
—AdrianW.
WestvContentsataGlanceAbouttheAuthorxixAbouttheTechnicalReviewerxxiAcknowledgmentsxxiiiIntroductionxxvChapter1:CreateandTestaMySQLDatabaseandTable1Chapter2:CreateWebPagesThatInteractwithUsers25Chapter3:Login/LogoutforMembersandanAdministrator61Chapter4:DisplayMembershipTablesfortheAdministrator93Chapter5:RegisterAddressesandPhoneNumbers125Chapter6:TheFinishingTouches157Chapter7:MigratingtoaHostandBackingUpYourWebSiteDatabase187Chapter8:CreatingaProductCatalog223Chapter9:AddingMultipleTablesandOtherEnhancements259Chapter10:CreatingaMessageBoard295Chapter11:E-Commerce:ABriefIntroduction335Chapter12:TroubleshootingYourDatabase-DrivenWebSite379Appendix387Index407viiContentsAbouttheAuthorxixAbouttheTechnicalReviewerxxiAcknowledgmentsxxiiiIntroductionxxvChapter1:CreateandTestaMySQLDatabaseandTable1DefiningtheTermDatabase1DefiningDeveloper,Administrator,andUser2DefiningInteractiveWebSites2OnlyUseMySQLforInteractiveDatabaseTables3MethodsforDevelopingandMaintainingDatabases3ABriefLookInsidetheMachinery3AFreeDevelopmentPlatformforTesting5UsingXAMPPonYourOwnComputer5WillIBeAbletoTransfertheDatabasefromXAMPPtoaRemoteHost5DownloadandInstallXAMPP6AccessingphpMyAdminUsingXAMPP10PlanningaDatabase:TheEssentialFirstStep12CreateaDatabaseUsingphpMyAdmin13CreateaTableUsingphpMyAdmin16TheSQLAlternative19DeletingDatabasesandTables22Summary24ContentsviiiChapter2:CreateWebPagesThatInteractwithUsers25CreatetheFolderforHoldingtheDatabasePages26CreatetheTemporaryTemplate26IntroducingthePHPinclude()Function28TheIncludedHeaderFile28TheIncludedMenuFile29TheIncludedInformationColumn31TheIncludedFooterFile31StylingtheTemporaryTemplate32TheInteractiveVersionoftheTemplate33ConnectingtotheDatabase35ExplanationoftheCode35TheRegistrationPage36ThePHPKeywordecho42StylingtheFormFields43StickyForms45ExplanationoftheCode46TheThankYouPage46DisplayingErrorMessagesThatAreCollectedinanArray47ViewingMembers'Records48TheViewUsersPage49ExplanationoftheCode50TheChangePasswordPage51ExplanationoftheCode54ConfirmingaSuccessfulPasswordChange54DealingwithanApostrophe54TutorialDealingwiththeApostrophe55ApostrophesWithinPHPcode57TestingtheTutorial'sPages57ContentsixMoreAboutArrays58Summary59Chapter3:Login/LogoutforMembersandanAdministrator61CreatetheLogindbDatabaseandTable62TidytheStyling63RemoveorReplaceRedundantMenuButtonsintheHeaders64AddaLoginButtontotheHomePageHeader65RemoveRedundantButtonsfromtheRegistrationandNewPasswordHeaders65TheRevisedRegistrationPage66TheNewHeaderfortheNewPasswordPage67ANewHeaderMenufortheMembers'Page67AmendtheHeaderfortheThank-YouPage68TheRegistrationPageandUndesirableCharacters69RegisterSomeMembers72DifferentiatingBetweenTwoTypesofMembership73CreateUserLevelstoLimitAccesstoPrivatePages73LogIn76TheHeaderfortheLoginPage77TheLoginPage78ExplanationoftheCode80TheLoginFormFields81Sessions82AMembers-onlyPage84ExplanationoftheCode86PlanningtheAdministrator'sRole87ANewHeaderfortheAdministrationPage87TheAdministrator'sPage88ExplanationoftheCode89ContentsxTheLogoutPage90ExplanationoftheCode90TestingtheLogin/logoutFunction91AmendingandDeletingIndividualRecords91Summary92Chapter4:DisplayMembershipTablesfortheAdministrator93TheAdministrationDatabase93TheUsersTable94TheRevisedAdministrationPage95ExplanationoftheCode97RevisingtheViewUsersPagetoIncludeEditingandDeleting98ExplanationoftheCode100DisplayingPagesofRecords(Pagination)102ExplanationoftheCode106PlanningtheSearchCriteria108ATemporaryPageforDisplayingSpecifiedMembers109ExplanationoftheCode111TheSearchForm112ExplanationoftheCode113TheFinalFormHandlerforReceivingSearchFormInput114EditingRecords116ExplanationoftheCode118DeletingRecords120ExplanationoftheCode122Summary123Chapter5:RegisterAddressesandPhoneNumbers125CreateaNewDatabaseandaTablewith17Columns125CreatetheFileforConnectingtotheDatabase126CreatetheTable126UsingENUM127ContentsxiTheImportanceofDocumentation128ExtendtheRegistrationForm,andAddaPull-downMenu129AlwaysAnnouncePricesandFeePaymentsUpFront130ExplanationoftheCode134StickyFieldsforaPull-downMenu136AddPayPalDebit/CreditCardImages136TheHeaderfortheRegistrationPage137IncludePayPalontheThankYouPage138ExplanationoftheCode140RegisterSomeMembers140ASmallAmendmenttotheLoginPage142AmendtheAdministrator'sHeader142ApplyPaginationtotheadmin_view_usersTable143ExplanationoftheCode146SearchingandEditingRecords147ExplanationoftheCode150ModifytheFormforEditingRecords150SearchingforMembers'AddressesandPhoneNumbers154Summary156Chapter6:TheFinishingTouches157CreatetheDatabase157CreatetheFileforConnectingtotheDatabase158CreatetheTablebyImportinganSQLDumpFile158IfyouwishtoCreatetheTableManually159RegisteringSomeMembersManually160TidytheFoldersandFilingSystem162TheStyleSheet163DegreesofSecurity164TheMinimumLayerofSecurity164AnIncreasedLayerofSecurity165ContentsxiiValidationandSanitization165Thefilter_var()Function166Validation166ExplanationoftheCode167Sanitization168TextAreasandSanitization168ValidatingTelephoneNumbers169AMoreSecureRegistrationPage169ExplanationoftheCode175SearchforanAddressandTelephoneNumber178ViewingtheRetrievedAddressandPhoneNumber179ExplanationoftheCode181EditAddressesandTelephoneNumbers182ExplanationoftheCode186Summary186Chapter7:MigratingtoaHostandBackingUpYourWebSiteDatabase187MakingLast-MinuteChanges187CreateaNewDatabase188DisplayingtheMembers'TitlesinthePaginatedTable190AllowMemberstoUpdateTheirOwnRecords191SafeE-mailing201AMinorProblem202ASecureFeedbackForm202TheFeedbackForm204TheStyleSheetsfortheFeedbackForm210TheThankYouPageandtheErrorMessages211MigratingtheDatabaseandTablestoaRemoteHost213APuzzlingErrorMessage214CreatingandExportingtheSQLFile214UsingtheGUIsonaRemoteHost'sServer218ConnectingtotheDatabaseontheRemoteHost219ContentsxiiiSecurelyUploadthemysqli_connect.
phpFile220UploadingtheInteractivePagestotheHost221BackUpYourDatabase222Summary222Chapter8:CreatingaProductCatalog223PreparetheDatabaseandAdministrationPlan223CreateaNewDatabase224CreatetheFileforConnectingtotheDatabase225Security226CreatingaHomePagewithSearchCapability226TheHeaderfortheMajorityofthePages228TheHomePageCode228DisplayingtheCatalog232ExplanationoftheCode235TheHeaderforthePageofSearchResults236CreatingtheAdmin/AddaHousePage236TheHeaderfortheAdministrator'sPage242TheHeaderwithTwoExtraButtons243Administrator'sViewoftheEntireStockofHousesforSale244TheAdministrator'sSearchPage247TheResultofaSearch248DisplayingtheFullDescriptionofaHouse250ExplanationoftheCode253TheContactUsPage253Summary258Chapter9:AddingMultipleTablesandOtherEnhancements259IntroductiontoMultipleTables259Normalization260CreatetheDatabaseandTables260ViewtheConnectionFile261ContentsxivPreparingtheTablesforJoining262AddSomeData266Joins267TheHomePagefortheMultipleTablesTutorial271TheMainMenufortheHomePage273PaymentsbyCheck285AChoiceofPaymentMethod287PrintingOnlineForms292ExplanationoftheCode293Summary294Chapter10:CreatingaMessageBoard295ThePlan296CreatetheDatabase296CreatetheTables297CreatetheTemplatefortheMessageBoardWebSite298CreatetheRegistrationForm301TheThankYouPage304RegisterSomeMembers306TheLoginPage306LoggingOut310CreatingaGatewaytotheTwoCategoriesofQuotes311TheFormforPostingQuotations312ExplanationoftheCode314ProcessingthePostings315ExplanationoftheCode316PostSomeQuotations317TheHomePage318ExplanationoftheCode320TheComicalQuotesPage320TheWiseQuotesPage322ContentsxvAddingSearchFacilities325ExplanationoftheCode327TheHeaderforViewPosts.
php327SearchforSpecificWordsorPhrases327PreparingtheTableforFullTextSearches328TheFullTextSearchForm328DisplayingtheSearchResults330ExplanationoftheCode332TheHeaderforthequotes_foundPage332EnhancingtheMessageBoard333ConvertingtheMessageBoardtoaForum333Summary334Chapter11:E-Commerce:ABriefIntroduction335ItemsCommontoBothShoppingCarts337SecurityWarning337ThePlan337TheHomePage338RegisteringUsers339TheLoginPagewithaForgotten-PasswordLink341RetrievingaForgottenPassword344Administration347CreatingtheAdministrationPage348SearchingandDisplayingProducts349FeaturesApplicableOnlytothePayPalShoppingCart351IntegratingwiththePayPalShoppingCart356DisplayingtheResultofaSearch358ACustomShoppingCart361TheDatabaseandTables363TheTables364AddPaintingstoaTableforaCustomShoppingCart366ContentsxviDisplayingtheProductsUsingCustomShoppingCartLinks368AddingPurchasestotheCart371TheCheckoutPage377AdditionalAdministrativeTasks378Summary378Chapter12:TroubleshootingYourDatabase-DrivenWebSite379HTMLCodeErrors380BrowserQuirks380AStyleChangeHasNoEffect380APageFailstoValidate380APayPalPull-DownMenuDoesNotWork381PHPScriptErrors381IncludedItemsMissingfromtheDisplay381CalltoanUndefinedFunction381CannotRedeclareFunction381UndefinedIndexorUndefinedVariable381EmptyVariableValue381GeneralVariableErrors382HeadersAlreadySent382BlankScreen382UnexpectedEndofFileinLinexxx382CommonPHPParseErrors383UnexpectedT_STRING383UnexpectedT_ELSE384WrongEqualsSign384FailedtoOpenStream384Warning:DivisionbyZero384DisplayIsNotWhatWasExpected384MySQLErrors385TableDisplaysHeadingsOnly385AccessDenied386ContentsxviiSyntaxErrors386ReferencetoaPrimaryKeyCouldNotbeCreated386Summary386Appendix387PHPQuickReference387Arrays387AssociativeArrays388Comments390Concatenation390Constants390E-mailingwithPHP390Functions392include()vs.
require()392if,else,andelseif393Loops394Numbers396QuotationMarks397Sessions397TernaryOperator399ValidationandSanitizationFilters400Variables400MySQLandphpMyAdminQuickReference401INSERT401SELECT401UPDATE401StorageEnginesandphpMyAdmin401ChangingtheStorageEngineonanExistingPopulatedTable402WhatNext403ResourcesforPHPandMySQL404HTMLandPHPEditingSoftware404ContentsxviiiPHPandMySQLInternetResources405ResourceforCreatingaForum405E-CommerceResources405OnlineTutorials405IntegratingPayPalwithaCustomShoppingCart406PayPalForums406Third-PartyShoppingCarts406Summary406Index407xixAbouttheAuthorAdrianWestresignedasacharteredengineertobecometheUKdirectorofacorrespondenceschool.
Hehasbeenteachinginoneformoranothersince1982.
Heintroducedcomputersintohisworkplacein1987andtaughtthestaffhowtousethem.
Forfouryears,hetaughtundergraduatescomputerskillsatacollegeinCheshireintheUnitedKingdom.
AdrianlivesinColyton,atowninDevon,England,andforthelast14years,hehasdesignedandproducedwebsitesforlocalbusinessesandcharities.
Foratime,healsoservedasacomputertechnicianandteachertoabout100peopleinhiscommunity.
Thenhedecidedtoconcentrateonhisfavoriteoccupation,designingwebsites.
Toavoiddisappointinghisformerclients,helaunchedafreecomputer-helpwebsiteathttp://www.
colycomputerhelp.
co.
uk.
Adrianalsowritesmonthlycomputer-helparticlesfortwolocalmagazines.
AdrianistheauthorofPracticalHTML5Projects(Apress.
com,2012),abookdedicatedtoimprovingthedesignofwebsites.
Thatbookwaspromptedbythelackofinformationoncertainaspectsofwebdesign.
Heresearched,tested,anddevelopedsolutionsfortheseusefulbutotherwisepoorlydocumentedtechniques.
xxiAbouttheTechnicalReviewerAndrewZackistheCEOofZTMC,Inc.
(ztmc.
com)specializinginSearchEngineOptimization(SEO)andInternetmarketingstrategies.
Hisprojectbackgroundincludesalmost20yearsofsitedevelopmentandprojectmanagementexperienceandover15yearsasaSEOandInternetmarketingexpert.
Mr.
Zackhasalsobeenveryactiveinthepublishingindustry,havingco-authoredFlash5Studioandservedasatechnicalrevieweronovertenbooksandindustrypublications.
xxiiiAcknowledgmentsIthankmywife,Janice,forherloveandsupport,fortakingovermyshareofthechoressothatIcouldconcentrateonthisbook,forherencouragement,andforputtingupwithmyabsenceasIhunchedoverthekeyboard.
Icouldneverhavemanagedwithouthermeticulousproofreading,whichshepatientlyrepeatedfourtimesperchapteraseacheditorialstagewasreached.
MythanksalsogotothemagnificentteamatApress:BenRenow-Clarkeforhisencouragementandforhisadviceonthelayoutandcontentofthechapters;KevinShea,whocoordinatedeverybodyandensuredthatIsentchaptersandfilesontime;andRogerLeBlanc,thecopyeditor,whopolishedmychaptersandhelpedmeconformtotheApresshousestyle.
IthankAndrewZack,thetechnicalreviewer,whocheckedmycodeandsuggestedseveralusefulresourcesforinclusioninthebook.
IthanktheApressproductionteamandSPiGlobalforpromptlyandefficientlydealingwithtweaksandrevisionstothepageproofs.
AndmythanksgotoallthepeopleinforumswhohelpedmeandrepliedtomyqueriesandtoallthosewhoplacedinformationontheInternet,fromwhichIlearnedsomuch.
—AdrianW.
WestxxvIntroductionTheTeachingMethodIamawebsitedesignerratherthanaprogrammer.
Mychoiceofabookisbasedonhowmuchpracticalapplicationitcontains,notonhowmuchabookconcentratesonthesyntaxofalanguageasanendinitself.
Thisbookfollowsmypreference;therefore,PracticalPHPandMySQLWebSiteDatabases-ASimplifiedApproachusesadifferentwayofteachingwebsitedatabasedesignthanthemajorityofmanuals.
TheusuallayoutstartswithseverallessonsonPHPfollowedbysnippetsofcommand-linecode,anditmayeventuallyconcludewithaprojectortwo.
Thisbookabandonsthatapproach.
Theprimaryfocusisonfullyworked,practicalMySQLdatabaseprojectsbuiltintoreal-worldwebpages.
Inthisbook,practicaldatabasesandinteractivewebpagesarepresentedasearlyaspossible;infact,youwillcreateadatabaseandatableinthefirstchapter.
Inthesecondchapter,youwillembedadatabaseintoaninteractive(dynamic)webpageandtestit.
Eachsubsequentchapterwillintroduceyoutoincreasinglysophisticatedandusefuldatabase-drivenwebsitepages.
ToabusywebdesignerwhoisunfamiliarwithPHPanddatabases,therequirementsinorderofimportanceareasfollows:HowtoembedPHPandinteractivedatabasesintoreal-worldwebpages.
Thisistheprimarythemethroughoutthebook.
Howtocreateafreeenvironmentfortestingdatabase-drivenwebpages.
Howtocreateauser-friendlyinterfacesothatanadministratorwithminimumcomputerskillscanmonitorthedatabase.
TounderstandhowPHP,HTML,andMySQLworktogethertocreateandmaintainadatabaseanditsdata.
InsteadofpresentingPHP,SQL,andMYSQLascompletelyseparatetopics,theseareexplainedincontextastheprojectsunfold.
However,whenyoueventuallybecomeproficientintheselanguages,aquickPHP/MySQLreferencewouldbehelpful;therefore,youwillfindthisintheAppendix.
Becausedatabasescanonlybeviewedandtestedonaserver,thefirstpartofChapter1hasinstructionsforusingafreeserverthatcanbedownloadedandinstalledonthereader'scomputer.
Thisensuresthatreaderswillhaveasafedevelopmentplatformforlearningandtestingastheyexplorethebook'spracticalprojects.
Astudyofthetheoryandsyntaxcandeterlearnersandprolongthetimeuntiltheygettheirhandsonapracticalapplication.
Thehistoryanddevelopmentofthecarandastudyoftheinternalcombustionenginewillnothelpawould-bedriver.
However,jumpingintoacaranddrivingitwillproducequickerresults,andlearnersareenthusedwhentheyachievesomething.
Thisbookjumpsintothedatabasedrivingseatrightfromthebeginning.
EssentialPHPandMySQLtechniquesarepresentedincontextwithineachtutorial,wheretheyaremostrelevant.
Somedatabasetextbooksadvocateusingaframework;theysuggestthatthisfacilitatesthedevelopmentofadatabase-drivenwebsite.
Ifindframeworksutterlyconfusing,eventhoughIhaveexperienceprogrammingdatabasesusingrawcode.
Ifyouareabeginner,Isuggestyousteerclearofframeworksuntilyouhavegainedsomemoreexperienceandunderstandthefundamentalsofhowadatabase-drivenwebsiteworks.
IntroductionxxviWhoIsThisBookForThebookassumesthatthereaderisthoroughlyfamiliarwithHTMLandCSS.
However,concerningMySQL,PHP,andphpMyAdmin,thebookstartsfromanabsolutebeginner'spointofview.
Asthechaptersunfold,theyprogresstowardsintermediatelevel.
Becausecommand-lineprogrammingwouldnotbewelcomedbythemoderngenerationofreaders,thebookconcentratesonmouse-operatedGraphicalUserInterfaces(GUIs)andPHPfilesforcreatingandmanagingdatabases.
YoudonotneedtoacquireanextensiveknowledgeofPHPtocreateinteractivedatabases.
IintroduceallthePHPyouwillneedintheappropriateplacewithineachproject.
EachpieceofPHPcodeisexplainedfullyinplainEnglish.
Thestep-by-step,fully-workedexampleswillshowyouwhatMySQLandPHPcandoandhowtodoit.
PracticalPHPandMySQLWebSiteDatabases-ASimplifiedApproachisforwebdesignerswhowishtobegindevelopingdatabase-drivenwebsites.
Liketheauthor,theymayhavestruggledwiththecurrentmanualsanddespaired.
Theymayalsohavebeenfrustratedbythelimitationsofpaint-by-numberscontentmanagementsystemssuchasJoomlaandWordpress.
Withthisinmind,PracticalPHPandMySQLWebSiteDatabases-ASimplifiedApproachusesahighlymotivational,step-by-stepapproach.
Theauthorrecognizesfullythatasenseofachievementencouragesthereadertolookforwardeagerlytothenextstep.
ForreaderswhohavelittleornoknowledgeofPHP,thebookwillteachenoughPHPtocompletealltheprojectsinthebook.
WebdeveloperswhoarereadytomovebeyondtheMySQLbasics,orwhohavenotkeptuptodatewiththeirMySQLandPHP,willalsobenefitfromPracticalPHPandMySQLWebSiteDatabases-ASimplifiedApproach.
CollegeanduniversityITteacherswillfindthatthebookprovidesanexcellentsettext;theprojectscanformabasisforstudentstoadaptfortheircoursework.
The"QuickandEasy-to-Learn"MythManualsfrequentlystatethatPHPandMySQLdatabasesareeasilyandquicklylearned.
Thisdiscouragesbeginners,becausewhentheyareconfrontedwiththeinevitabledifficulties(anderrormessages),theybegintothinkthattheywillnevergraspeventhebasicprinciples.
Beginnersshouldnotbediscouragediftheyrememberthefollowingfact:authorsclaimingthatPHPandMySQLareeasilyandquicklylearnedarenotbeingdeceptive;theyhaveprobablybeenusingPHPandMySQLformorethanadecadeandhaveforgottenthedifficultiestheyencounteredwhentheyfirstbegan.
IfyouacceptthatsometimeandeffortisrequiredtolearnPHPandMySQL,thenastimepasses,itwillbecomeincreasinglyapparentthatyouarelearningsomethingveryworthwhile.
Thetaskwillbecomeprogressivelyeasier,sohavepatienceandpersevere.
Youwillthenbegintoenjoymasteringthisvaluablenewdiscipline.
TheOriginofThisBookIwasaskedtoenhanceoneofmyclient'swebsitesbyaddingamembershipdatabaseandamembers'registrationform.
AlthoughIhavedesigned,developed,andmaintainedwebsitesformanyyears,IhadnoknowledgeofMySQLdatabases.
IboughtandborrowedaboatloadofbooksandsearchedtheInternetfortutorials.
Iwasverydisappointedwiththemajorityofthebooks.
MostoftheMySQLmanualstendedtodemonstratetheauthor'sdeepandextensiveknowledgeofPHPandMySQLinsteadofteachinghowtoembedMySQLdatabasesintowebpages.
Incontrast,thisbookusesfullyworkedexamplestodemonstratehowtointegratedatabasesintoawebsite.
PHP/MySQLmanualscanhaveupto800pages,whichwoulddeteranybeginner.
Ionceboughtsuchamanual.
Itcontainedhardlyanypracticalworkedexamples.
ThismeantthatIcouldonlyusethebooktostandonwhenchangingalightbulb.
(Themanualwasalmost2inchesthick.
)IntroductionxxviiThemanyMySQLdatabasemanualsthatIown(orborrowed)wereunnecessarilycomplicated.
Theauthorshadbecomeusedtousingneattricksandshortcutsthatweresecondnaturetothem.
Theseclutteredthecode,makingitdifficultforbeginnerstodiscernthebasicstructure.
PracticalPHPandMySQLWebSiteDatabases-ASimplifiedApproachavoidsthismistake.
AfewusefultricksareintroducedgraduallyandarefullyexplainedinplainEnglish.
IbasedthebookonaquotefromthecomposerBrahms,whosaid:Itiseasytocomposebutwonderfullyhardtoletthesuperfluousnotesfallunderthetable.
MySQLmanualsarenearlyalwayswrittenassumingthatthewebdesignerwilladministerthedatabases.
Smallere-commercewebsites,clubs,andsocietiescannotaffordtodothisandwouldpreferthattheirmembershipsecretarywasabletoadministerthedatabaseusingauser-friendlyinterface.
Ofcourse,thewebdesignershouldalwaysbeavailableformajoradministrativejobs,suchasaddinganewcolumnoratable.
Themajorityofthedatabasescreatedinthisbookcanbeadministeredbybothanunskilledmembershipsecretaryandthewebdesigner.
SomemanualsprovideinstructionsusingonlyMS-DOSstylecommand-lines.
HavingusedaGUI(mouse-operatedsystem)fromthestartoftheircomputingexperience,anyoneundertheageof40wouldnotknowwhatanMS-DOScommandlinewas.
Somemanualspublishedin2012stillusecommand-linelistings.
WhatwouldabeginnermakeofthesortofcodeshowninFigure1Figure1.
Anexampleofthecommand-linecodethatwouldfrightenmostbeginnersSometimesIhadasmanyassevenMySQL/PHPmanualsopenatthesametimetopiecetogetherenoughinformationtocompleteasimpletask.
Inparallel,IranInternetsearchestosupplementthemostobscuremanuals;sadly,someforumstendedtodealmorewithpaint-by-numbers(CMS)websitesratherthanHTMLwebsites.
Onlytwoofthesevenmanualstookthetroubletoembeditsdatabasesintoreal-worldwebpages.
Eventually,IconcludedthatImustwritemyownmanualbasedonwhatIcouldlearnbyconcatenatingsnippetsofinformationfrommultipleresources.
Ialsobasedthemanualonmyowntrial-and-errorapproachasarawbeginner.
Thisautomaticallyensuredthatthemanual'scontentwaspresentedinsimple,logical,andprogressivestepswithoutsuddenlyintroducingunexplaineditems.
Myhome-grownmanualwassousefulthatIdecidedthatitshouldbesharedwithotherwebsitedesigners.
Thisbookistheresultofthatdecision.
Computersoftwareanddatabasetechniquesareconstantlyimprovingandbeingupdated.
Becauseofthis,mostoftheavailablemanualsandInternettutorialswereobsolescent,soIhadtoresearchthelatestversionsofthescripts,tools,andtheavailablesoftware.
Thisensuredthatmycontentandillustrationswouldremainrelevantforaslongaspossible.
Tofollowthetutorialsinthisbookrequiresanabsoluteminimumofsoftware.
Somemanualsaskreaderstodownloadandlearnanewpieceofsoftwarebeforetheycanproceedtoeachnewchapter.
IcameacrossonebookthatrequiredreaderstodownloadMySQL,Apache,PHP,phpMyAdmin,Prototype1.
5,Scriptaculous,ZendFramework,SmartyTemplateEngine,FCKeditor,Jquery,andAjax.
Inthisbook,inadditiontoacodeeditor,Ihavelimitedthesoftwaretooneitemasdescribednext.
IntroductionxxviiiWhatEquipmentIsRequiredThebookassumesthat,asawebdesigner,youwillalreadyhaveanHTMLeditorsuchasDreamweaver,MSExpressionWeb(nowfree),Kompozer(free),orNotePad++(free).
IusedMSExpressionWebbecauseitwasaboutonethirdofthepriceofDreamweaveranditusedaninterfacesimilartoMSWord.
IwasconsideringanupdatetomyExpressionWeb,butitwouldcostabout199,whichdeterredme.
Then,suddenly,MicrosoftdecidedtodiscontinuethedevelopmentandmaintenanceofExpressionWebandoffereditfreeofcharge.
Naturally,IwasdelightedandpromptlydownloadedthelatestversionofExpressionWebVersion4;Icanthoroughlyrecommendit.
Inadditionyouwillneed:Anotebookforrecordingthepasswordsandfilenamesforyourdatabasesandtableentries.
DON'TRELYONMEMORY;WRITEEVERYTHINGDOWNYouwillneedtodownload:Thesamplecodefromthebook'spage,availableatwww.
apress.
com.
XAMPP,afree,all-in-onepackagefortestingyourwork.
Thelatestbrowsers(allfree):InternetExplorer,MozillaFirefox,Safari,Chrome,andOpera.
TheConventionsUsedinThisBookCarehasbeentakentorelateeverylistingtoitsscreenshot.
Forinstance,Figure3-6willbedescribedbyListing3-6.
Iftwolistingsareneeded,suchastheHTMLcodeandtheCSS,bothwillrelatetothescreenshotbyusingListing3-6aandListing3-6b.
IfascreenshotsuchasFigure4-6doesnotneedalisting,thenextscreenshotandlistingwilluseFigure4-7andListing4-7.
Specialtips,notes,andwarningsareshowninthefollowingformat:NoteSecurityisveryimportantwhendealingwithdatabases,especiallyiftheycontainpersonaldata.
Thetechniqueformakingyourworksecureiswovenintoeachstepoftheinstructions.
AllcodelistingsuseHTML5andPHP.
Themetadescriptionandmetakeywordshavebeenomittedfromeachsectiontosavespace.
Codelistingsareshownasfollows:Codeshowninboldtypeindicateseitheranewfeatureorachangefromapreviousversionofthecode.
Codelinesaresometimesnumberedtohelpwiththeexplanationsasfollows:if(empty($errors)){//Ifnoproblemsoccured,registertheuserinthedatabase#1Thelinenumbersareforexplanationonlyandmustnotbeincludedinyourowncode.
IntroductionxxixInteractivevs.
DynamicMostmanualsusetheterm"dynamic"webpageswhenreferringtointeractivepages.
Thewordsdynamicandinteractivebothdescribepagesthatprovidealivelinkbetweenauserandadatabase.
Forinstance,ausercanregisterformembershipandviewhis/heraccountdetails.
Amembershipsecretarycanviewatableofmembers,butthetableishiddenfromordinarymembers.
Becausetheworddynamiccanhavesomanyconnotationsandmeanings,Ihavechosentousethemorepreciseterminteractiveinthisbook.

7月RAKsmart独立服务器和站群服务器多款促销 G口不限量更低

如果我们熟悉RAKsmart商家促销活动的应该是清楚的,每个月的活动看似基本上一致。但是有一些新品或者每个月还是有一些各自的特点的。比如七月份爆款I3-2120仅30美金、V4新品上市,活动期间5折、洛杉矶+硅谷+香港+日本站群恢复销售、G口不限流量服务器比六月份折扣力度更低。RAKsmart 商家这个月依旧还是以独立服务器和站群服务器为主。当然也包括有部分的低至1.99美元的VPS主机。第一、I...

AkkoCloud(60元/月 ),英国伦敦CN2 1核 768 MB 内存 10 GB SSD 硬盘 600GB 流量 英国伦敦CN2 1核  1.5G  300Mbps

官方网站:https://www.akkocloud.com/AkkoCloud新品英国伦敦CN2 GIA已上线三网回程CN2 GIA 国内速度优秀.电信去程CN2 GIALooking Glass:http://lonlg.akkocloud.com/Speedtest:http://lonlg.akkocloud.com/speedtest/新品上线刚好碰上国庆节 特此放上国庆专属九折循环优惠...

HostKvm($4.25/月),俄罗斯CN2带宽大升级,俄罗斯/香港高防限量5折优惠进行中

HostKvm是一家成立于2013年的国外VPS服务商,产品基于KVM架构,数据中心包括日本、新加坡、韩国、美国、俄罗斯、中国香港等多个地区机房,均为国内直连或优化线路,延迟较低,适合建站或者远程办公等。本月,商家旗下俄罗斯、新加坡、美国、香港等节点带宽进行了大幅度升级,俄罗斯机房国内电信/联通直连,CN2线路,150Mbps(原来30Mbps)带宽起,目前俄罗斯和香港高防节点5折骨折码继续优惠中...

headersalreadysent为你推荐
http500http 500是什么意思?支付宝是什么什么是支付宝? 请详细介绍.www.topit.mehttp://www.topit.me/ 中自己上传的照片如何删除duplicate500银花珠树晓来看用黄皮比喻心酸的诗句curl扩展如何增加mysqli扩展400电话查询如何辨别400电话的真伪?地址栏图标网站添加地址栏图标代码怎么写?powerbydedecms如何去掉底部的 powered by dedecmszencartzencart 难吗?我想要学习zencart 从最基础开始?网上教程都不全。电脑城买的到从头到尾的教程吗?
域名拍卖 天津服务器租赁 国内vps 国外vps租用 圣迭戈 国外空间 发包服务器 谁的qq空间最好看 中国电信测网速 免费私人服务器 空间登入 重庆电信服务器托管 石家庄服务器托管 阿里云手机官网 域名转入 云服务是什么意思 碳云 godaddy退款 alexa搜 asp简介 更多