PHP & MySQL: Novice to Ninja
206 pages
English

Vous pourrez modifier la taille du texte de cet ouvrage

Découvre YouScribe en t'inscrivant gratuitement

Je m'inscris

PHP & MySQL: Novice to Ninja , livre ebook

-

Découvre YouScribe en t'inscrivant gratuitement

Je m'inscris
Obtenez un accès à la bibliothèque pour le consulter en ligne
En savoir plus
206 pages
English

Vous pourrez modifier la taille du texte de cet ouvrage

Obtenez un accès à la bibliothèque pour le consulter en ligne
En savoir plus

Description

PHP & MySQL: Novice to Ninja, 7th Edition is a hands-on guide to learning all the tools, principles, and techniques needed to build a professional web application using PHP & MySQL. Comprehensively updated to cover PHP 8 and modern best practice, this highly practical and fun book covers everything from installation through to creating a complete online content management system.


  • Gain a thorough understanding of PHP syntax
  • Master database design principles and SQL
  • Write robust, maintainable, best practice code
  • Build a working content management system (CMS)
  • And much more!

Sujets

Informations

Publié par
Date de parution 10 février 2022
Nombre de lectures 6
EAN13 9781098129538
Langue English
Poids de l'ouvrage 6 Mo

Informations légales : prix de location à la page 0,1450€. Cette information est donnée uniquement à titre indicatif conformément à la législation en vigueur.

Extrait

PHP & MySQL: Novice to Ninja, 7th Edition
Copyright © 2022 SitePoint Pty. Ltd.
Ebook ISBN: ISBN 978-1-925836-47-9 Product Manager: Simon Mackie Technical Editor: Tim Boronczyk English Editor: Ralph Mason Cover Designer: Alex Walker
Notice of Rights
All rights reserved. No part of this book may be reproduced, stored in a retrieval system or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews.
Notice of Liability
The author and publisher have made every effort to ensure the accuracy of the information herein. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors and SitePoint Pty. Ltd., nor its dealers or distributors will be held liable for any damages to be caused either directly or indirectly by the instructions contained in this book, or by the software or hardware products described herein.
Trademark Notice
Rather than indicating every occurrence of a trademarked name as such, this book uses the names only in an editorial fashion and to the benefit of the trademark owner with no intention of infringement of the trademark.

Published by SitePoint Pty. Ltd.
10-12 Gwynne St, Richmond, VIC, 3121 Australia Web: www.sitepoint.com Email: books@sitepoint.com

About SitePoint
SitePoint specializes in publishing fun, practical, and easy-to-understand content for web professionals. Visit http://www.sitepoint.com/ to access our blogs, books, newsletters, articles, and community forums. You’ll find a stack of information on JavaScript, PHP, design, and more.
About the Author
Tom Butler is a web developer and university lecturer. He has a PhD in the area of software engineering best practices and enjoys evaluating different approaches to programming problems.

Preface
It was 1998, I was twelve, and my parents had just bought the family our first modern PC. It wasn’t long before I had figured out how to change the code for one of my favorite first-person shooter games—little things like making the rocket launcher fire a hundred rockets a second instead of one, then having it fire a hundred rockets in every direction … and promptly crashing the game. I was hooked, and I’ve been programming ever since.
The game was multiplayer. Other people had also discovered how to change the code, and the arms race quickly escalated. Someone would fire a hundred rockets at me. I’d have a script ready that would instantly build a wall right in front of me to block them all.
My opponent would spawn a dozen land mines underneath me. I’d turn off the gravity, then jump, soaring away from the impending explosion. Everyone could fly. It got to the point where it was no longer fun. You’d enter a game and someone had written a script to teleport you to the other side of the map, kill you instantly and force you to respawn, repeating the process a dozen times a second. They’d freeze your controls too, of course.
We discovered ways to block all this, but by the end it was a stalemate. Whoever managed to enter the game first could take complete control of it, and no matter how good your scripts were, there was nothing you could do. It was fun while it lasted.
That’s how I learned the basics of coding, and that the only limit is your own imagination and creativity. During that time, I’d also taught myself HTML, and had my own website where I shared some of my game hacking techniques and scripts. No, the website isn’t still up. Yes, it was terrible, full of bad grammar and cheesy animations (which was the style at the time, I promise!).
By 2000, I had taught myself the basics of PHP and MySQL and was running a website for a group of fellow gamers. I wrote some crude PHP scripts for posting news on the website, as well as polls, and even a script for handling our mini-tournament rankings and fixtures.
After that, I moved on to writing desktop applications in a horrible language called Delphi, writing tools that aided people in modding various games. I graduated from University in 2007 with a degree in Software Engineering, worked for various companies as a PHP developer, then went back to academia to study for a PhD in Software Engineering. I currently teach at the University of Northampton in the UK.
I’m 34 now, and I’ve been programming for more of my life than not. It’s fun, and it’s something I thoroughly enjoy doing. I’m writing this book to share my knowledge with you and help you steer clear of some traps that are easy to fall into.
Learning to code is very enjoyable and rewarding. You can watch your program come alive as you build it. However, it can also be an incredibly frustrating experience. In this book, I’m going to try to use my own experience to give you a smoother ride than I and a lot of developers have had. I can steer you in the right direction from the start.
Before I introduce you to any code, I’m going to give you some general advice about programming and learning to code—advice which I give to all my students.
Who Should Read This Book
This book is aimed at intermediate and advanced web designers looking to make the leap into server-side programming. You’ll be expected to be comfortable with simple HTML, as I’ll make use of it without much in the way of explanation. No knowledge of Cascading Style Sheets (CSS) or JavaScript is assumed or required, but if you do know JavaScript, you’ll find it will make learning PHP a breeze, since the basics of both languages are quite similar.
By the end of this book, you can expect to have a grasp of what’s involved in building a modern PHP website, the basics of PHP, and tried and tested techniques that are used by developers today. Most importantly, you’ll come away with everything you need to build your own website!
Programming Has Changed
As a novice developer starting now, there’s a lot more you need to know before you can publish a website than someone who was building a website in 2001.
When I started, it was a much simpler time. For example, website security wasn’t much of a consideration. Unless you were a bank or a company taking credit card payments, there was very little chance anyone would target your site.
These days, however, every single website is constantly bombarded by bots and scripts specifically looking to exploit even the smallest doors you may have left open.
The way PHP scripts are written has changed dramatically as well—certainly for the better. It’s now much, much easier to download and use someone else’s code in your own project. The downside to this is that you need a much broader understanding of programming concepts before you can do anything useful.
To keep up with the competition, and with the needs of more demanding projects, PHP and MySQL have also had to evolve. PHP is now a far more intricate and powerful language than it was back in 2001, and MySQL is a vastly more complex and capable database. Learning PHP and MySQL today opens up a lot of doors that would have remained closed to the PHP and MySQL experts of 2001.
That’s the good news. The bad news is that, in the same way that a butter knife is easier to figure out than a Swiss army knife (and less likely to cause self-injury!), all these dazzling new features and improvements have indisputably made PHP and MySQL more difficult for beginners to learn.
It Takes 10,000 Hours to Become an Expert
The science behind this statement is questionable, but the sentiment is correct. Programming is a skill, and it’s incredibly difficult to master. Don’t expect to become proficient overnight. By the end of this book, you’ll have a good understanding of PHP, but there’s always more to learn, regardless of the level you’re at.
Having said that, in programming a little knowledge can go a long way. You’ll be surprised how much you can do with just a few tools at your disposal!
You’ll find that, after you’ve learned the very basics, you can achieve almost anything you want. There’ll be very little you can’t do, even though you only know a fraction of the programming concepts that are out there. The more advanced concepts are about making your code more efficient, quicker and easier to write, and much simpler to build on top of.
Resist the Temptation to Skip Ahead
This is one I reiterate time and time again for my students who miss lectures. Programming concepts build on top of each other. For the most part, you need to learn the earlier concepts before you can move on to the next one. If you try to move too fast, you’ll get needlessly confused and make it more difficult for yourself.
There aren’t many programming concepts that exist in isolation, so if you get stuck, it’s often a result of not fully understanding an earlier concept. Don’t be afraid to go back and give yourself a refresher on what you think you already know from before. It’s usually quicker overall than struggling and trying to press forward when you get stuck!
The Concorde Fallacy
In the late 1970s, the British and French governments continued to fund the Concorde aircraft even though it was losing vast amounts of money. Their reasoning was that they had already spent so much on the project that, if they scrapped it, they’d lose everything they had invested so far. Of course, they eventually lost considerably more because they kept throwing money at it. If they had stopped sooner, they would have saved a lot of money in the long run. This is often referred to as the “Concorde fallacy”. There are times when it’s better to cut your losses than keep working on a failed project!
There will come a time when you’ve spent hours on something and it’s just not working. When this happens, take a step back and try to solve the problem in a different way. Use some of the alternative tools you have at your disposal. The solution might not be as elegant, but once you have

  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents