Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
PHP Programming With MySQL Second Edition.doc
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
43.07 Mб
Скачать

INDEX

Inline styles, 632

specificity, 635

input streams, 267

INSERT INTO statement, 412–414

installing

Notepad++, 622–625

Portable Apps Suite, 620–622

text editors, 620–625

xAMP, 636–638

instance(s), 560

instanceof operator, 58, 62

instantiation, 560

MySQL database objects, 566–568

(int) operator, 58, 61

integer(s), 31

(integer) operator, 58

interfaces, 559–560

internal array pointer, 323

internal style(s), 632–634

internal style sheets, specificity, 635

Internet Explorer, viewing source code,

665

is_dir() function, 243

is_executable() function, 243

is_file() function, 243

is_link() function, 243

is_readable() function, 243

isset() function, 209, 650

is_writable() function, 243

is_writeable() function, 243

iterating through arrays, 323–327

iterations, 96

less than or equal to operator (>+), 51

Levenshtein, Vladimir, 158

Levenshtein distance, 158

levenshtein() function, 158

line comments, 21

linked style sheets, 634–635

literal(s), 40

literal strings, 14

LOAD DATA statement, 414–415

local variables, 82

locking files, 272–274

logging errors to a file, 661

logging in to phpMyAdmin, 428–431

logic, analyzing, 663–664

logic errors, 656–657

logical And operator (&&), 55

logical exclusive Or operator (XOR), 55

logical Not operator (!), 55

logical operators, 54–58

logical Or operator (||), 55

loop statements, 95–109

do...while statements, 100–103

foreach statements, 105–109

for statements, 103–105

while statements, 96–100

loosely typed programming languages, 31

lowercase markup tags, XHTML, 628

686

M

magic quotes, 196–198, 653–654

mail() function, 206, 207

maintaining state, 497

many-to-many relationships, 386–388

matching characters in regular expressions,

162–164

MAX() function, 418

md5() function, 138–139

member functions, 573, 584–599

cleaning up with destructor functions,

587–588

initializing with constructor functions,

585–587

serialization functions, 594–599

$this reference, 585

writing accessor and mutator functions,

588–594

member selection notation, 564

member variables, 573

J

junction tables, 387

K

key(s), arrays, determining if a key exists,

333–334

key() function, 323, 324

keywords. See also specific keywords

SQL, 391

krsort() function, 336, 342

ksort() function, 336, 337, 342

L

LAMP, 636

less than operator (>), 51


INDEX

metacharacters, 162

metaphone() function, 159

method(s), OOP, 557, 582

method attributes, 192–194

Microsoft Internet Explorer, viewing source

code, 665

microtime() function, 258

MIME (Multipurpose Internet Mail

Extensions), 248

minus sign (-)

addition operator, 62

compound subtraction assignment

operator, 49, 62

conversion specifications, 645, 646

decrement operator, 44–48, 61

subtraction operator, 42

mkdir() function, 241–242

modifying variables, 25–27

modulus (%), 42

moving files, 278–280

Mozilla Firefox, viewing source code, 665

multidimensional arrays, 350–359

with more than two dimensions, 357–359

with single statement, 356–357

two-dimensional, associative, 355–356

two-dimensional, indexed, 351–355

multiple code declaration blocks, 17–20

multiplication operator (*), 42

Multipurpose Internet Mail Extensions

(MIME), 248

mutator functions, 588–594

MySQL, 389, 391, 392–402, 399–402

accessing with PHP. See accessing MySQL

with PHP; connecting to MySQL

with PHP; retrieving records

commands, 394–395, 396–398

creating databases, 399–400

deleting databases, 401–402

identifiers, 395–396

logging in, 392–394

MySQL Monitor, 392, 394–395

selecting databases, 400–401

user privileges, 408–412

MySQL database objects

closing, 566

errors, handling, 568–570

executing SQL statements, 570–573

instantiating, 566–568

MySQL tables, 459–463

creating, 460–463

deleting, 463

mysql_affected_rows() function, 470–471

mysql_change_user() function, 449

mysql_create_db() function, 453–454

mysql_data_seek() function, 474

mysql_drop_db() function, 458

mysql_errno() function, 451–452

mysql_error() function, 451–452

mysql_fetch_array() function, 474

mysql_fetch_assoc() function, 474,

687

477–478

mysql_fetch_lengths() function, 474

mysql_fetch_row() function, 474–476

mysql_free_result() function, 479

mysql_get_client_info() function, 449

mysql_get_client_version() function,

449

mysql_get_host_info() function, 449

mysql_get_proto_info() function, 449

mysql_get_server_info() function, 449

mysqli_connect_errno() function, 452

mysqli_connect_error() function, 452

mysql_info() function, 471–473

mysql_num_fields() function, 480–481

mysql_num_rows() function, 460

mysql_query() function, 459–460, 464, 473,

479

mysql_select_db() function, 455–457

mysquli package, 448

N

name argument, cookies, 519–521

naming. See also renaming

counters, 96

files, 3, 651, 652

variables, 23

natcasesort() function, 336, 337

natsort() function, 336, 337

navigating within Web page templates, 214

nested decision-making structures, 89–92

nested tags, XHTML, 628–629

attributes, 629

new clone, associativity, 61

next() function, 323, 325

normalization, 384

not equal operator (!= or <>), 51


INDEX

notation

avoiding pitfalls, 40

exponential, 31

member selection, 564

scientific, 31

Notepad++, installing, 622–625

notice messages, 658

NULL value, 30

number(s)

decimal, specifying precision, 643–644

formatting, 645–646

number_format() function, 645–646

numeric data, validating, 199–200

numeric data type, 31–32

operands, 40

operator(s), 40–41

arithmetic, 41–48

assignment, 48–51

associativity, 61–63

binary, 41, 42–44

comparison, 51–52, 53–55

conditional, 52–55

logical, 54–58

postfix, 44–48

prefix, 44–48

special, 58

unary, 41, 44–48

operator precedence, 61–63

OR operator, 55, 62

Oracle, 674–677

ord() function, 154

order by keyword, 421

output steams, 267

688

O

object(s), 557

database connections as objects, 565–573

MySQL database objects. See MySQL

database objects

using in PHP scripts, 563–578

(object) operator, 58, 61

object-oriented PHP

declaring data members, 578–583

member functions. See member functions

objects, 563–578

object-oriented programming (OOP),

557–563

classes, 560–563

encapsulation, 559–560

PHP. See object-oriented PHP

observer functions, 588–594

ODBC (Open Database Connectivity), 390,

447

one-to-many relationships, 384–386

one-to-one relationships, 383–384

one-way hashes, 138–139

OOP. See object-oriented PHP; object-

oriented programming (OOP)

Open Database Connectivity (ODBC), 390,

447

opendir() function, 238

opening

file streams, 267–269

MySQL connections, 448–451

opening delimiters, regular expressions,

161

opening tags, XHTML, 628

P

padding, specifying, 644–645

parameters (formal parameters), 75–76

passing by reference, 80–81

passing by value, 80

parent table, 382

parse error(s), 655–656

parse error messages, 657–658

parsing strings, 141

passing arguments, 11

path argument, cookies, 525

pattern modifiers, 169–170

PCRE. See Perl Compatible Regular

Expressions (PCRE)

percent sign (%)

compound modulus assignment operator,

49

conversion specifications, 641

modulus, 42

period (.). See dot (.)

Perl Compatible Regular Expressions (PCRE)

delimiters, 160

escape sequences, 168

quantifiers, 164

persistent cookies, 518

PHP

object-oriented. See object-oriented PHP

ODBC, 447


INDEX

PHP script(s), 2–3

code declaration blocks. See code

declaration blocks

comments, 20–22

cookie interference, 521

delimiters. See PHP script delimiters

displaying results, 12–16

filename extensions, 3

statements, 3–4

PHP script delimiters, 3–5

ASP-style, 9–10

phpinfo() function, 190, 196, 448

php.ini file, 530

changing settings in, 653

phpMyAdmin, 428–433

databases, 431–432

logging in, 428–431

tables, 432–433

phpversion() function, 18

pipe (|), logical Or operator, 55, 62

plus sign (+)

addition operator, 42, 62

compound addition assignment operator,

49, 62

conversion specifications, 645

increment operator, 44–48, 61

quantifier, 164

Portable Apps Suite, installing, 620–622

postfix operators, 44–48

PostgreSQL, 389

pound symbol (#), comments, 21

predefined constants, 29

prefix operators, 44–48

preg_grep() function, 160

preg_match() function, 160

preg_quote() function, 160

preg_replace() function, 160

preg_split() function, 160

prev() function, 323

primary array, 343

primary key, 383

primary table, 382

primitive data type, 30

print() function, 564

print statement, 13

print_errors directive, 659

printf() function. See formatting strings

print_r() function, 662

print_startup_errors directive, 659

private access specifier, 580

privileges, MySQL, 408–412

definition, 408

granting, 409–411

revoking, 411–412

processing

All-in-One forms, 210

form data, 194–198

programming language(s)

loosely typed, 31

strongly typed, 31

programming language constructs, 13

pronunciation, determining if two words are

pronounced similarly, 159

properties, OOP, 557

protected access specifier, 580

proxy user, accessing databases, 652–653

public access specifier, 580

689

Q

quantifiers, 164–165

queries, 389

accessing query result information,

479–481

closing query results, 479

retrieving records, 473–481

SQL. See MySQL; structured query

language (SQL)

query results, closing, 479

query strings, saving state information,

515–517

question mark (?)

conditional operators, 62

quantifier, 164

separating form data and URL tokens, 192

special operator, 58

R

RDBMSs (relational database management

systems), 389

readdir() function, 238

readfile() function, 254

reading

cookies, 526–529

data, incrementally, 275–277

directories, 238–241

entire files, 262–266


INDEX

records, databases, 381, 412–427

adding, 412–415

adding to MySQL databases,

464–465

aggregate functions, 418–420

deleting, 427, 465–466

filtering query results, 423–425

retrieving, 415–418

sorting query results, 421–423

updating, 425–426, 465

redisplaying All-in-One forms, 210–212

reference, passing parameters by, 80–81

reference data type, 30

register_globals directive, disabling,

653

regular expressions, 160–170

defining character classes, 166–169

matching characters, 162–163

matching characters at beginning and end

of a string, 163

matching multiple pattern choices, 169

matching special characters, 163–164

pattern modifiers, 169–170

specifying quantity, 164–165

specifying subexpressions, 165–166

writing regular expression patterns,

161–162

related table, 382

relational database(s), 382

relational database management systems

(RDBMSs), 389

removing. See deleting

rename() function, 280–281, 282

renaming

columns in database tables, 407

database tables, 407

directories, 280–281

files, 280–281

repeating code. See loop statements

reporting errors, 653, 657–658

MySQL, 451–452

setting error reporting level, 659–661

$_REQUEST[] autoglobal array, avoiding,

650

require() function, 651

require statements, 109–111

require_once() function, 651

reset() function, 323, 325

690

“resource” data type, 30

result pointers, 459–460

resultsets, 459–460

retrieving records, 415–418, 473–481

accessing query result information,

479–481

into associative array, 477–478

closing query results, 479

into indexed array, 474–477

working with query results, 473–478

retrieving submitted data, 194–198

return statements, 78–81

revoking privileges, 411–412

rewinddir() function, 238

rmdir() function, 282

rsort() function, 337, 338–339, 342, 343

run-time errors, 656

S

saving state information. See state

information

scandir() function, 238

schemas, databases, 388

scientific notation, 31

scope, variables, 82–83

script(s). See PHP script(s)

<script> element, 6–7

script output, examining, 664–665

secondary arrays, 344

secure argument, cookies, 526

secure coding, 648–654

accessing databases through proxy users,

652–653

avoiding $_REQUEST[] autoglobal array,

650

changing settings in php.ini, 653–654

storing code in external files, 651–652

validating submitted form data,

649–650

validating user identities using sessions,

650–651

SELECT statement, 415–418, 419–425

select_db() function, 566

selecting

databases, 400–401, 455–458

files, 247


INDEX

member selection notation, 564

serialization, 582–583

serialization functions, 594–599

serialize() function, 594

session(s)

deleting, 536–537

saving state information, 530–537

starting, 531–532

validating user identities, 650–651

working with session variables, 532–536

session IDs, 531

session variables, 532–536

setcookie() function, 519, 520, 522

settype() function, 59

short PHP script delimiters, 8–9

SHOW TABLES LIKE command, 461

shuffle() function, 343

similar_text() function, 158

simple key, 383

simple string syntax, 131

single quotation mark (’)

conversion, 138

format control strings, 641

values in style definitions, 634

__sleep() function, 594–595

sleep() method, 582

sort() function, 337, 338–342

sorting

arrays, 336–343

query results, 421–423

soundex() function, 159

source code, viewing, 665

special characters

matching, 163–164

Web forms, handling, 196–198

special operators, 58

sprintf() function. See formatting strings

spyware, 530

SQL. See MySQL; structured query language

(SQL)

SQL Server, 671–674

square brackets ([])

array elements operator, 61

special operator, 58

starting sessions, 531–532

state information, 496–539

saving using cookies, 517–529

saving using hidden forms, 506–515

saving using query strings, 515–517

saving using sessions, 530–537

statefulness, 497

statelessness, 497

statements, 3–4. See also specific statement

names

loop. See loop statements

static typing, 31

status messages, displaying for users, 207–208

STDDEV() function, 418

STDDEV_POP() function, 418

STDDEV_SAMP() function, 418

STD() function, 418

stick forms, 203

storing

classes in external files, 576–577

code in external files, 651–652

uploaded files, 249–252

strcasecmp() function, 156, 157–158

strchr() function, 142

strcmp() function, 156–157

stream(s), 267. See also file streams

stream_get_line() function, 275

strict equal operator (===), 51

strict not equal operator (!==), 51

string(s), 124–172

comparing. See comparing strings

constructing, 125–133

converting between strings and arrays,

151–153

counting characters and words,

134–135

dividing into smaller pieces,

147–151

encoding and decoding, 138–139

escape characters and sequences,

128–131

formatting. See formatting strings

modifying case, 135–138

parsing, 141

regular expressions. See regular

expressions

returning portions, 139

string operators, 126–128

strrev() function, 139

str_shuffle() function, 139

691


INDEX

string(s), 124–172 (continued)

substr() function, 139

substrings. See substrings

syntax, 131–133

trim() function, 139

string data, validating, 200–201

(string) operator, 58, 61

string operators, 126–128

stripslashes() function, 197

str_ireplace() function, replacing

strongly typed programming languages, 31

strpos() function, 142

strrchr() function, 142–143

str_replace() function, replacing

strrev() function, 140

strtok() function, 147–151

strtolower() function, 135–136

strtoupper() function, 135, 136

structured query language (SQL), 389,

390–391

keywords, 391

MySQL. See MySQL

style(s), CSS, 631–635

external, 635

inline, 632, 635

internal, 632–634, 635

style sheets

external (linked), 634–635

internal, 635

subexpressions, specifying, 165–166

subpatterns, specifying, 165–166

substr() function, 139

substrings, 141–147

finding and extracting, 141–144

replacing, 144–147

subtraction operator (-), 42

SUM() function, 418

superglobals, 189–191

switch statements, 92–95

nested, 89–92

symbolic links, 243

syntax errors, 655–656

creating, 404–406

deleting, 408

MySQL tables. See MySQL tables

phpMyAdmin, 432–433

removing, 407

renaming, 407

specifying field data types, 402–404

table relationships, 382–388

table relationships, databases, 382–388

tags, XHTML, 628–629

temporary cookies, 518

text editors, installing, 620–625

text files, 234

text hyperlinks, 214

$this reference, 585

tilde (˜), separator string, 302

tokens, 147–151

tracing errors with echo statements,

661–662

transformer functions, 588–594

trim() function, 139

two-dimensional arrays

associative, 355–356

indexed, 352–355

two-part forms, 209

type casting, 59–61

type specifiers, 642–643

692

U

uaksort() function, 337

ucfirst() function, 136, 137

ucwords() function, 136, 137

uksort() function, 337

T

table(s), 402–408

altering, 406–407

columns. See columns, database tabless

UML (Unified Modeling Language),

558

unary operators, 41

arithmetic, 44–48

Unicode, 674

Unified Modeling Language (UML),

558

unlink() function, 281–282

unset() function, 313

UPDATE statement, 425–426

updating database records, 425–426, 465

uploading files, 247–252

retrieving file information, 248

selecting files, 247


INDEX

storing uploaded files, 249–252

URL tokens, 192–193

user privileges. See privileges, MySQL

usort() function, 337

WAMP

accessing WampServer online,

639

installing, 636–638

installing directory structure for student

files, 640

testing installation, 638–639

WampServer menu, 639

warning messages, 658

W3C (World Wide Web Consortium),

625

Web browser, displaying errors, 659

Web forms

All-in-One. See All-in-One forms

arrays, 359–364

data. See form data

e-mailing, 206–207

two-part, 209

XHTML, 191–194

Web page templates, 212–213

navigating within, 214

Web servers, configuring, 636–640

WHERE keyword, 423

while statements, 96–100

words

counting instrings, 134–135

determining of two words are pronounced

similarly, 159

World Wide Web Consortium (W3C),

625

write permission, precautions, 259

writing

data, incrementally, 270–272

entire files, 257–262

V

validation

All-in-One forms, 209

CSS styles, 635

data entered in forms, 199–201

submitted form data, 649–650

user identities, using sessions,

650–651

XHTML documents, 629–631

value(s)

attributes, 629

determining if a value exists,

328–333

determining if form variables contain,

199

passing parameters by, 80

returning, 78–81

value argument, cookies, 519–521

var keyword, 580

var_dump() function, 662

variables, 22–27

declaring, 23

determining if form variables contain

values, 199

displaying, 24–25

environmental, 190

global, 82–83

initializing, 23–24

local, 82

modifying, 25–27

naming, 23

scope, 82–83

session, 532–536

VARIANCE() function, 418, 419

VAR_POP() function, 418

VAR_SAMP() function, 418

viewing. See also displaying

source code, 665

693

X

xAMP

installing, 636–638

testing installation, 638–639

XHTML, 620–635

advanced escaping from, 204

CSSs, 631–635

DOCTYPE declarations, 625–626

document structure, 627

installing editors, 620–625

lowercase markup tags, 628

nested tags, 628–629

W

__wakeup() function, 595

wakeup() method, 582


Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]