In this script, I??™m making
use of the PECL JSON class
(which must be installed; see
http://pecl.php.net??”it??™s
enabled by default as of PHP
5.2).
??? Alternatively, see the o?¬? cial
JSON Web site (www.json.org)
for includable PHP libraries that
can perform the conversion of an
array to JSON.
146 Appendix
JavaScript frameworks p. 140
??? There are three main downsides
to using frameworks. The fi rst is
that they require some effort to
learn how to use them. The second
is that they normally greatly
increase the amount of data
that a user must download from
your site (which is to say, frameworks
are almost inherently
bloated). Finally, you must pay
attention to new releases of a
framework, as they might patch
security holes.
??? In choosing a framework, factor
in how many and what browsers
it supports, how large it is
(in terms of fi le size that the user
will end up downloading), and
how well documentated it is.
Appendix 147
This page intentionally left blank
index
SYMBOLS
$error variable, 68, 71, 72
$errors array, 50, 52
... (ellipses), in code blocks, xii
\n (newline character), 109
+ (plus sign), in JavaScript, 83
values, 13
A
adding employees, 43??“58
HTML pages, creating, 44, 45??“48
PHP scripts, creating, 44, 49??“54
testing, 54??“56
adding employees (using Ajax), 59??“86
Ajax, setting up, 64, 82
database, updating, 72
form data, preparing, 65??“66, 83
form data, validating, 68??“71, 84
HTML pages, modifying, 62, 82
HTML pages, updating, 75??“79, 85
JavaScript files, creating, 62??“63, 83
overview of, 60??“61
PHP scripts, new, 67, 83
testing, 80??“81
XML, completing, 73??“74
Ajax
Ajax layer, applying, 63, 103??“104
alternatives to, 131
basics of, x??“xi
checking for support of, 28
elements, adding, 62, 102
frameworks, listed, 141
indexing Ajax pages, 130
limitations of, 130, 146
setting up, 30, 64, 105
testing, and Firefox, 42
alerts, JavaScript, 143
appendChild( ) function, 127
B
back buttons, 130
bookmarking, 130, 146
browsing employees, 11??“24
CSS style sheets and, 12, 19??“20, 24
databases, connecting to, 12, 18, 23
HTML pages, creating, 12, 13??“14, 22
PHP scripts, writing, 12, 15??“17,
22??“23
testing pages, 12, 21, 24
browsing employees (using Ajax),
25??“42
functions, calling, 29??“31, 35??“36,
40, 41??“42
functions, making, 27??“28, 39
HTML pages, modifying, 37
PHP scripts, writing, 32??“34, 41
testing, 38, 42
149
index
C
Castro, Elizabeth, xviii, 22, 24
code in this book
downloading, xii
JSON alternative to XML, 134??“138
collation (database), defined, 9
columns
adding to tables, 9
column definitions, 10
INSERT query and, 58
concatenation, defined, 83
createElement( ) function, 127
CSS style sheets
creating, 12, 19??“20, 24
page appearance and, 45, 89
using, 20
D
databases
adding records to, 53
collation, defined, 9
connecting to, 12, 18, 23
querying, 108
updating, 72
databases, creating, 1??“10
basics of, 3??“4, 9
MySQL, accessing, 2, 9
tables, creating, 5??“6, 9
tables, populating, 7??“8, 10
debugging
Ajax applications, 42
Firebug and, 145
Firefox and, 15, 145
JavaScript, 142??“145
MySQL client and, 97
PHP scripts and, 23, 24
PHP-MySQL, 58, 84, 125
running mysql client and, 97
Venkman JavaScript Debugger, 145
XML, 84, 125
departments
department column, 9
department IDs and PHP pages,
15, 16
department_id value, 10
departments table, 9, 10
departments variable, 113
drop-down list of, 12, 48
GET method and, 57, 82
in searches, 117??“118
select menu of, 14
Document Object Model (DOM)
inspectors, 144
dot syntax, JSON, 138
E
ellipses (.
Pages:
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126