PHP, MySQL, & JavaScript All-in-One For Dummies

PHP, MySQL, & JavaScript All-in-One For Dummies

von: Richard Blum

For Dummies, 2018

ISBN: 9781119468370 , 795 Seiten

Format: PDF, Online Lesen

Kopierschutz: DRM

Mac OSX,Windows PC Apple iPad, Android Tablet PC's Online-Lesen für: Mac OSX,Linux,Windows PC

Preis: 32,99 EUR

eBook anfordern eBook anfordern

Mehr zum Inhalt

PHP, MySQL, & JavaScript All-in-One For Dummies


 

Title Page

3

Copyright Page

4

Table of Contents

7

Introduction

19

About This Book

19

Foolish Assumptions

20

Icons Used in This Book

21

Beyond the Book

21

Where to Go from Here

21

Part1 Getting Started with Web Programming

23

Chapter 1 Examining the Pieces of Web Programming

25

Creating a Simple Web Page

25

Kicking things off with the World Wide Web

26

Making sense of markup languages

27

Retrieving HTML documents

28

Styling

32

Creating a Dynamic Web Page

35

Client-side programming

37

Server-side programming

39

Combining client-side and server-side programming

42

Storing Content

43

Chapter 2 Using a Web Server

45

Recognizing What’s Required

45

The web server

46

The PHP server

47

The database server

48

Considering Your Server Options

49

Using a web-hosting company

50

Building your own server environment

51

Using premade servers

55

Tweaking the Servers

59

Customizing the Apache Server

59

Customizing the MySQL server

62

Customizing the PHP server

64

Chapter 3 Building a Development Environment

69

Knowing Which Tools to Avoid

69

Graphical desktop tools

70

Web-hosting sites

70

Word processors

71

Working with the Right Tools

71

Text editors

71

Program editors

79

Integrated development environments

82

Browser debuggers

85

Part2 HTML5 and CSS3

89

Chapter 1 The Basics of HTML5

91

Diving into Document Structure

91

Elements, tags, and attributes

91

Document type

93

Page definition

94

Page sections

96

Looking at the Basic HTML5 Elements

99

Headings

99

Text groupings

100

Breaks

102

Marking Your Text

103

Formatting text

103

Using hypertext

104

Working with Characters

108

Character sets

108

Special characters

109

Making a List (And Checking It Twice)

110

Unordered lists

110

Ordered lists

111

Description lists

113

Building Tables

114

Defining a table

114

Defining the table’s rows and columns

115

Defining the table headings

117

Chapter 2 The Basics of CSS3

121

Understanding Styles

121

Defining the rules of CSS3

122

Applying style rules

128

Cascading style rules

129

Styling Text

130

Setting the font

130

Playing with color

134

Working with the Box Model

137

Styling Tables

139

Table borders

140

Table data

141

Positioning Elements

143

Putting elements in a specific place

146

Floating elements

148

Chapter 3 HTML5 Forms

153

Understanding HTML5 Forms

153

Defining a form

154

Working with form fields

155

Using Input Fields

156

Text boxes

156

Password entry

158

Check boxes

159

Radio buttons

160

Hidden fields

161

File upload

162

Buttons

163

Adding a Text Area

164

Using Drop-Down Lists

165

Enhancing HTML5 Forms

167

Data lists

167

Additional input fields

168

Using HTML5 Data Validation

172

Holding your place

172

Making certain data required

173

Validating data types

173

Chapter 4 Advanced CSS3

175

Rounding Your Corners

175

Using Border Images

177

Looking at the CSS3 Colors

180

Playing with Color Gradients

182

Linear gradients

182

Radial gradients

183

Adding Shadows

184

Text shadows

184

Box shadows

185

Creating Fonts

186

Focusing on font files

187

Working with web fonts

187

Handling Media Queries

189

Using the @media command

189

Dealing with CSS3 media queries

190

Applying multiple style sheets

193

Chapter 5 HTML5 and Multimedia

195

Working with Images

195

Placing images

196

Styling images

197

Linking images

199

Working with image maps

200

Using HTML5 image additions

201

Playing Audio

203

Embedded audio

203

Digital audio formats

204

Audio the HTML5 way

206

Watching Videos

208

Paying attention to video quality

208

Looking at digital video formats

209

Putting videos in your web page

210

Getting Help from Streamers

212

Part3 JavaScript

213

Chapter 1 Introducing JavaScript

215

Knowing Why You Should Use JavaScript

215

Changing web page content

216

Changing web page styles

216

Seeing Where to Put Your JavaScript Code

217

Embedding JavaScript

217

Using external JavaScript files

221

The Basics of JavaScript

221

Working with data

222

Data types

223

Arrays of data

224

Operators

225

Controlling Program Flow

227

Conditional statements

227

Loops

234

Working with Functions

238

Creating a function

239

Using a function

240

Chapter 2 Advanced JavaScript Coding

241

Understanding the Document Object Model

241

The Document Object Model tree

242

JavaScript and the Document Object Model

244

Finding Your Elements

251

Getting to the point

251

Walking the tree

253

Working with Document Object Model Form Data

256

Text boxes

256

Text areas

257

Check boxes

258

Radio buttons

259

Chapter 3 Using jQuery

261

Loading the jQuery Library

262

Option 1: Downloading the library file to your server

263

Option 2: Using a content delivery network

264

Using jQuery Functions

264

Finding Elements

265

Replacing Data

268

Working with text

268

Working with HTML

270

Working with attributes

271

Working with form values

271

Changing Styles

272

Playing with properties

272

Using CSS objects

274

Using CSS classes

275

Changing the Document Object Model

277

Adding a node

277

Removing a node

278

Playing with Animation

279

Chapter 4 Reacting to Events with JavaScript and jQuery

281

Understanding Events

281

Event-driven programming

282

Watching the mouse

282

Listening for keystrokes

283

Paying attention to the page itself

284

Focusing on JavaScript and Events

285

Saying hello and goodbye

285

Listening for mouse events

287

Listening for keystrokes

291

Event listeners

293

Looking at jQuery and Events

294

jQuery event functions

294

The jQuery event handler

298

Chapter 5 Troubleshooting JavaScript Programs

301

Identifying Errors

301

Working with Browser Developer Tools

303

The DOM Explorer

304

The Console

305

The Debugger

308

Working Around Errors

313

Part4 PHP

319

Chapter 1 Understanding PHP Basics

321

Seeing the Benefits of PHP

321

A centralized programming language

322

Centralized data management

322

Understanding How to Use PHP

323

Embedding PHP code

323

Identifying PHP pages

324

Displaying output

325

Handling new-line characters

327

Working with PHP Variables

328

Declaring variables

329

Seeing which data types PHP supports

330

Grouping data values with array variables

333

Using PHP Operators

335

Arithmetic operators

335

Arithmetic shortcuts

336

Boolean operators

337

String operators

338

Including Files

338

The include() function

338

The require() function

341

Chapter 2 PHP Flow Control

343

Using Logic Control

343

The if statement

344

The else statement

346

The elseif statement

346

The switch statement

348

Looping

349

The while family

349

The for statement

351

The foreach statement

352

Building Your Own Functions

354

Working with Event-Driven PHP

357

Working with links

357

Processing form data

361

Chapter 3 PHP Libraries

367

How PHP Uses Libraries

367

Exploring PHP extensions

368

Examining the PHP extensions

369

Including extensions

371

Adding additional extensions

372

Text Functions

372

Altering string values

372

Splitting strings

374

Testing string values

377

Searching strings

378

Math Functions

379

Number theory

379

Calculating logs and exponents

380

Working the angles

381

Hyperbolic functions

382

Tracking statistics

382

Date and Time Functions

383

Generating dates

383

Using timestamps

385

Calculating dates

386

Image-Handling Functions

387

Chapter 4 Considering PHP Security

393

Exploring PHP Vulnerabilities

393

Cross-site scripting

394

Data spoofing

397

Invalid data

398

Unauthorized file access

400

PHP Vulnerability Solutions

402

Sanitizing data

402

Validating data

407

Chapter 5 Object-Oriented PHP Programming

413

Understanding the Basics of Object-Oriented Programming

413

Defining a class

414

Creating an object instance

415

Using Magic Class Methods

419

Defining mutator magic methods

419

Defining accessor magic methods

421

The constructor

424

The destructor

425

Copying objects

426

Displaying objects

426

Loading Classes

427

Extending Classes

432

Chapter 6 Sessions and Carts

437

Storing Persistent Data

437

The purpose of HTTP cookies

438

Types of cookies

439

The anatomy of a cookie

440

Cookie rules

442

PHP and Cookies

442

Setting cookies

442

Reading cookies

444

Modifying and deleting cookies

446

PHP and Sessions

448

Starting a session

449

Storing and retrieving session data

449

Removing session data

453

Shopping Carts

454

Creating a cart

454

Placing items in the cart

455

Retrieving items from a cart

455

Removing items from a cart

456

Putting it all together

456

Part5 MySQL

461

Chapter 1 Introducing MySQL

463

Seeing the Purpose of a Database

463

How databases work

464

Relational databases

467

Database data types

469

Data constraints

469

Structured Query Language

470

Presenting MySQL

472

MySQL features

472

Storage engines

474

Data permissions

475

Advanced MySQL Features

476

Handling transactions

476

Making sure your database is ACID compliant

477

Examining the views

479

Working with stored procedures

480

Pulling triggers

481

Working with blobs

481

Chapter 2 Administering MySQL

483

MySQL Administration Tools

483

Working from the command line

484

Using MySQL Workbench

488

Using the phpMyAdmin tool

493

Managing User Accounts

495

Creating a user account

495

Managing user privileges

499

Chapter 3 Designing and Building a Database

507

Managing Your Data

507

The first normal form

508

The second normal form

509

The third normal form

509

Creating Databases

510

Using the MySQL command line

510

Using MySQL Workbench

513

Using phpMyAdmin

515

Building Tables

518

Working with tables using the command-line interface

518

Working with tables using Workbench

523

Working with tables in phpMyAdmin

526

Chapter 4 Using the Database

531

Working with Data

531

The MySQL command-line interface

532

The MySQL Workbench tool

537

The phpMyAdmin tool

540

Searching for Data

542

The basic SELECT format

543

More advanced queries

545

Playing It Safe with Data

549

Performing data backups

550

Restoring your data

556

Chapter 5 Communicating with the Database from PHP Scripts

559

Database Support in PHP

559

Using the mysqli Library

561

Connecting to the database

562

Closing the connection

563

Submitting queries

564

Retrieving data

565

Being prepared

567

Checking for errors

569

Miscellaneous functions

571

Putting It All Together

572

Part6 Creating Object-Oriented Programs

579

Chapter 1 Designing an Object-Oriented Application

581

Determining Application Requirements

581

Creating the Application Database

583

Designing the database

583

Creating the database

586

Designing the Application Objects

589

Designing objects

589

Coding the objects in PHP

591

Designing the Application Layout

597

Designing web page layout

598

The AuctionHelper page layout

599

Coding the Website Layout

600

Creating the web page template

600

Creating the support files

605

Chapter 2 Implementing an Object-Oriented Application

611

Working with Events

611

Bidder Object Events

613

Listing bidders

613

Adding a new bidder

621

Searching for a bidder

623

Item Object Events

623

Listing items

624

Adding a new item

629

Searching for an item

632

Logging Out of a Web Application

632

Testing Web Applications

634

Chapter 3 Using AJAX

637

Getting to Know AJAX

637

Communicating Using JavaScript

639

Considering XMLHttpRequest class methods

640

Focusing on XMLHttpRequest class properties

641

Trying out AJAX

643

Using the jQuery AJAX Library

647

The jQuery $.ajax() function

647

The jQuery $.get() function

651

Transferring Data in AJAX

653

Looking at the XML standard

653

Using XML in PHP

654

Using XML in JavaScript

658

Modifying the AuctionHelper Application

661

Chapter 4 Extending WordPress

669

Getting Acquainted with WordPress

669

What WordPress can do for you

670

How to run WordPress

671

Parts of a WordPress website

672

Installing WordPress

673

Downloading the WordPress software

673

Creating the database objects

674

Configuring WordPress

676

Examining the Dashboard

680

Using WordPress

682

Exploring the World of Plugins

687

WordPress APIs

688

Working with plugins and widgets

689

Creating Your Own Widget

692

Coding the widget

692

Activating the widget plugin

694

Adding the widget

695

Part7 Using PHP Frameworks

699

Chapter 1 The MVC Method

701

Getting Acquainted with MVC

701

Exploring the MVC method

702

Digging into the MVC components

704

Communicating in MVC

708

Comparing MVC to Other Web Models

709

The MVP method

710

The MVVM method

710

Seeing How MVC Fits into N-Tier Theory

711

Implementing MVC

712

Chapter 2 Selecting a Framework

713

Getting to Know PHP Frameworks

713

Convention over configuration

714

Scaffolding

716

Routing

717

Helper methods

718

Form validation

718

Support for mobile devices

718

Templates

719

Unit testing

719

Knowing Why You Should Use a Framework

720

Focusing on Popular PHP Frameworks

722

CakePHP

722

CodeIgniter

723

Laravel

725

Symfony

726

Zend Framework

727

Looking At Micro Frameworks

728

Lumen

728

Slim

729

Yii

731

Chapter 3 Creating an Application Using Frameworks

733

Building the Template

733

Initializing the application

734

Exploring the files and folders

736

Defining the database environment

737

Creating an Application Scaffold

739

Installing the scaffolding

739

Exploring the scaffolding code

742

Modifying the Application Scaffold

743

Adding a new feature link

744

Creating the controller code

746

Modifying the model code

748

Painting a view

749

Index

753

EULA

795