Book Details

php-mysql-javascript-html5-all-in-one-for-dummies

php-mysql-javascript-html5-all-in-one-for-dummies


- (minus sign), 197, 290 - special character, 324 ! (exclamation point), 332–333 !=, <> comparison operator, 321 !== comparison operator, 321 # (pound sign), 131, 173 $ (dollar sign), 282, 283, 324, 405 $() construct, 225, 227 $_SESSION arrays, 438 $fh variable, 384 $result variable, 519 $(this) selector, 231 $this variable, accessing properties with, 404–405 % (modulus) sign, 290 &#160; entity, 100–101 &nbsp; entity, 100–101 ( ) special character, 324 ( | | ) special character, 324 * (asterisk), 197, 290, 324 . (periods), 132, 294, 324 .htaccess file, setting PHP options in, 636 / (forward slash), 197, 290, 327 :hover pseudoclass, 251 ? special character, 324 @ symbol, 301, 315 [ ] (square brackets), 296, 324 \ (backslash), 292, 324, 327 \n PHP character, 280–281, 293 \t PHP character, 293 ^ special character, 324 __ (two underscores), 407 { , } special character, 324 {} (curly braces), 208, 276–277, 278, 284, 285 + (plus sign), 196, 289, 290, 324 < comparison operator, 321 <= comparison operator, 321 = (equal sign), 194, 282 == (equal operator), 421–422 == comparison operator, 321 === (identical operator), 421–422 === comparison operator, 321 > comparison operator, 321 >= comparison operator, 321 ’ (single quote), 292 “ “ (double quotes), 285 ‘ ‘ (single quotes), 285 A a date format symbol, 309 A date format symbol, 309 a mode, 384 a+ mode, 384 <a> tag, 94, 108–109, 111–112 About page, building, 650–651 absolute versus relative links, 111 abstract classes, 415–417 abstract methods, 415–418 access denied error message, 69 access to databases, controlling, 459–462 accessing text files, with PHP, 384–386 accounts, MySQL adding, 465 administrator responsibilities regarding, 458 attributes of, 459 names of, 460–461 overview, 455, 462, 464 passwords, 461, 465–466 privileges, 461–462, 466–467 removing, 467–468 viewing information about, 464 action attribute, 172–173 add_numbers function, 350–351 addBorder class, 143 addClass() function, 239 addNumbers function, 205–207656 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies AddType statements, 47–48, 49 administration of MySQL accounts, setting up, 462, 464–468 administrator responsibilities, 457–458 backing up databases, 468–471 controlling access to data, 459–462 default root account, 458 overview, 457 restoring data, 471–473 upgrading MySQL, 473 alert() function, 204, 262 alerts, 191–193, 262 aligning web form fields with CSS, 180–183 ALL privilege, 462 all-in-one installation kits for Apache, 24 for MySQL, 59 for PHP, 38–39 XAMPP installation kit Control Panel, using, 78–79 installing, 76–78 obtaining, 75–76 overview, 24, 38, 59, 75 reinstalling, 84–85 testing, 79–82 troubleshooting, 85 uninstalling, 84–85 alt attribute, 114 ALTER privilege, 462 ALTER statement, 494–495, 514 Amazon, 541 anchor tag, 94, 108–109, 111–112 and, in comparisons, 327–329 anonymous function, 225 antivirus utilities, 434 Apache advantages of, 14 checking version of, 42 configuring, 32–33, 83–84 configuring for PHP, 47–48, 49 getting information on, 31 installing on local computers, 19–20 installing PHP on Linux or Unix with, 41 obtaining, 22–24 overview, 8, 21, 273 PHP compatability with, 273 running as service, 85 securing, 426–427 starting and stopping, 28–30 testing web servers, 21–22 verifying downloaded files, 24–25 version of, checking, 41 XAMPP Control Panel, starting and stopping with, 78–79 Apache option, configure command, 43 Apache VirtualHost container, 636 Apache website, obtaining Apache from, 23 apachectl script, 29 append() function, 228–229 apxs utility, 40, 42, 43, 44 arguments, adding to functions, 204 arithmetic operations on numeric data types, 289 arithmetic operators, 290–291 array_key_exists() function, 538 arrays $_SESSION, 438 creating, 296–297 getting values from, 301–302 holding multiple values in, 195 for loops, 202–203 multidimensional, 305–306 overview, 288, 296 reading files into, 388–389 removing values from, 299 sorting, 299–301 viewing, 298–299 walking through values in, 302–305 arsort function, 301 ASCII code, 321, 380 asort function, 300, 301 assigning strings to variables, 292 timestamps to PHP variables, 309–310 values to PHP variables, 282–283Index asterisk (*), 197, 290, 324 attacks, handling, 429–432, 433 attr() function, 233, 234, 236, 238 attributes action, 172–173 alt, 114 database, 478–479 href, 108 HTML, 108 id, 177, 182 maxsize, 173 method, 172 name, 112, 177, 178 in OOP, 399 selected, 175, 176 setting, 232–237 size, 173 src, 113, 190, 234 target, 112 value, 173–174 authenticate function, 610, 611 authenticated pages, adding, 612–618 AUTO_INCREMENT field, 524 auto_prepend_file function, 531–532 B background colors, changing, 147–150 background images, 113, 150–154 background-color CSS property, 147 background-image CSS property, 150–154 background-position CSS property, 153 backing up databases, 458, 468–471 by web-hosting companies, 17 backslash (\), 292, 327 backticks, 372, 373–374 ball objects, creating, 208 657 basename function, 367 basic selectors, jQuery, 226 beginning statements, in for loops, 337 BIGINT data type, 483 binary files, 23, 37, 58, 380 bindir=DIR option, PHP, 45 blank account names, 460 blank fields, checking for on web forms, 246–247 blank hostnames, 461 blank web pages, troubleshooting, 53 block-level elements, 98, 160 blocks, 276–278 body section, HTML documents, 94 <body> element, 130 Boolean data type, 288, 295–296 borderClass class, 238–239 borders adding to HTML tables, 107–108 CSS, 140–144 bottom of page, in templates, 646 <br> tag, 94, 99–100 break statements, 334, 335, 344–346 breaking out of loops, 344–346 browser cookies checking if enabled, 438–440 overview, 438 browser detection, 214–216 browsers defined, 7 detecting with JavaScript, 214–216 fonts, choosing web-friendly, 138–140 general discussion, 8 JavaScript support, 188, 220 on mobile devices, 10 redirecting to other pages, 216–217 testing CSS across multiple, 122–123 brute force attack, 461 built-in PHP functions, 356, 637–638 bullet styles, 145–146658 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies C C syntax, 277 calling functions, 204–205 Can’t connect to . . . error message, 70 Cascading Style Sheets (CSS) advantages of, 122 background colors, changing, 147–150 background images, adding, 150–154 borders, 140–144 classes, 131–134 comments, 132 external style sheets, 128–129 font color, setting, 138–140 font family, setting, 134–136 font size, setting, 136–138 footers, 163–167 on forms, reviewing, 561–562 general discussion, 11, 121–122 headers, 163–167 hiding elements, 161 inline, 122–126 internal style sheets, 126–128 jQuery, changing with, 237–240 limitations of, 122–123 list styles, 144–147 matching cases with HTML, 131 overview, 121 for registration pages, 597–598 single-column layout, creating, 155–158 targeting styles background colors, changing, 147–150 groups of elements, 131–134 individual elements, 130–131 overview, 128–129 selecting HTML elements, 130 two-column layout, creating, 159–162 web form fields, aligning with, 180–183 case sensitivity with JavaScript, 194 jQuery, 226 matching CSS with HTML, 131 PHP statements, 276 PHP variables, 282 SQL, 451–452 cast, 288 catch block, 420 CDN-hosted jQuery, 220, 222–223 CGI (Common Gateway Interface), 427 chaining, 230 changeImage() function, 237 CHAR data type, 483 character data, storing, 481–482 character encoding, 119 character input in text boxes counting characters in, 254–257 preventing, 257–259 character strings assigning to variables, 292 double-quoted, 292–294 joining, 294 overview, 288, 292 single-quoted, 292–294 SQL queries, 452 storing long, 295 check boxes, 170, 176–177, 579–580 child classes, 400, 415–417 circle list style, 144 class methods, building, 628–632 class statements, 402, 403 class_exists function, 422 classes $this variable, accessing properties with, 404–405 abstract, 415–417 benefits of, 534–535 class statements, writing, 403 constructor, writing, 409–410 CSS, 131–134 disabling, 637–638 getting information about, 422–423 methods, adding, 405–407Index overview, 398–399, 402 preventing changes to, 418 private properties and methods, 407–409 properties, setting, 403–404 public properties and methods, 407–409 simplifying, 410–413 template, creating, 642–643 User, building, 607–610 using in scripts, 413–415 clear CSS property, 157 clearing web forms, 180 CLI (command line interface), 453 click event handlers, 247–251 click() function, 250 client does not support authentication protocol error message, 69–70 client software, 453 client-server model, 7 client-side validation, 555, 556 __clone method, 420–421 closing tags, 91 closing text files, 386 color of background, changing, 147–150 of font, setting with CSS, 138–140 hex codes for, 137–138 columns_priv table, 463 comma-delimited files adding data to databases, 500 creating, 391 overview, 389–391 reading, 391 command line interface (CLI), 453 comma-separated values (CSV) files converting to TSV files, 392–393 creating, 391 overview, 389–391 reading, 391 659 comments CSS, 132 HTML, 101–102 JavaScript, 193, 262–264 PHP, 316–318 commercial licenses for MySQL, 58 Common Gateway Interface (CGI), 427 Community Server, 57 company websites, web hosting for, 15–16 comparing objects, 421–422 comparison operators, 320–322 complex statements, 276–277, 319 computers, setting up for web development MySQL, installing, 20 overview, 19 PHP, installing, 20 web servers, installing, 19–20 concatenation, 196, 294 conditional blocks, 276–277 conditional statements in for loops, 338 if statements, 330–333 overview, 319, 329–330 switch statements, 329, 333–335 conditionals, 197–200 conditions, setting up comparing values, 320–322 joining multiple comparisons, 327–329 overview, 320 pattern matching with regular expressions, 323–327 testing variable content, 322 confidentiality of websites, 587 configuration files Apache, 83–84 editing, 82 MySQL, 65, 84 PHP, 83 configure command, 27–28, 41, 43–44660 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies configuring Apache, 32–33 configuring php.ini files disabling functions and classes, 637–638 error display, changing, 639 making changes outside of, 636 overview, 635 resource limits, changing, 639 session parameters, changing, 637 session timeout, changing, 636–637 working with, 635 connecting to MySQL server, 517–519 connection verification, 459 Console Panel, Firebug add-on, 267 console.log, 268 constants, 287–288 __construct method, 410 constructor, writing, 409–410 Contacts page, building, 651–653 continue statements, 344–346 Control Panel, XAMPP, 78–79, 85 converting HTML special characters to entities, 432 convertState function, 538, 539 cookies checking if enabled, 438–440 overview, 438 session parameters, changing, 637 copy statement, 368 copying files with PHP functions, 368–369 objects, 420–421 corrupt tables, replacing from backups, 471 counting characters in text boxes, 254–257 CREATE DATABASE statement, 489–490 CREATE privilege, 462 CREATE TABLE statement, 491–493 CREATE USER statement, 465 Creative Commons, 150 cross site scripting, 430 crypt() function, 610 CSS (Cascading Style Sheets) advantages of, 122 background colors, changing, 147–150 background images, adding, 150–154 borders, 140–144 classes, 131–134 comments, 132 external style sheets, 128–129 font color, setting, 138–140 font family, setting, 134–136 font size, setting, 136–138 footers, 163–167 on forms, reviewing, 561–562 general discussion, 11, 121–122 headers, 163–167 hiding elements, 161 inline, 122–126 internal style sheets, 126–128 jQuery, changing with, 237–240 limitations of, 122–123 list styles, 144–147 matching cases with HTML, 131 overview, 121 for registration pages, 597–598 single-column layout, creating, 155–158 targeting styles background colors, changing, 147–150 groups of elements, 131–134 individual elements, 130–131 overview, 128–129 selecting HTML elements, 130 two-column layout, creating, 159–162 web form fields, aligning with, 180–183 CSS classes, 131–134 CSV (comma-separated values) files converting to TSV files, 392–393 creating, 391 overview, 389–391 reading, 391Index curly braces ({}), 208, 276–277, 278, 284, 285 current statement, 303 currentVal variable, 256 D d date format symbol, 308 D date format symbol, 309 dashed border style, 141 data adding to databases, 498–502 choosing for databases, 475–477 transfer fees, by web-hosting companies, 17 data types BIGINT, 483 Boolean, 288, 295–296 CHAR, 483 character strings, 292–295 DATE, 483 DATETIME, 484 DECIMAL, 483 ENUM, 484 floating-point numbers, 289–291 INT, 483 integer, 288, 289–291 integers, 289–291 MySQL, 481–484 NULL, 288, 296 numeric, 289–291 object, 288 overview, 288–289 querying PHP, 289 resource, 288 SERIAL, 484 TEXT, 483 TIME, 483 VARCHAR, 483 database design choosing data for, 475–477 documentation, 487–488 organizing data, 477–480 overview, 475 661 relationships between tables, creating, 480–481 sample, 484–487 storing different types of data, 481–484 databases browsing data in, 502 building, 489–493 choosing data for, 475–477 controlling access to, 459–462 data, adding, 498–502 organizing data, 477–480 overview, 475, 497 relationships between tables, creating, 480–481 removing data from, 513–514 retrieving data from, 502 combining data from separate tables, 508–513 overview, 502–503 specific information, 503–504 in specific orders, 505 from specific rows, 505–508 sample, 484–487 storing different types of data, 481–484 structure of, 450, 494–495 updating data in, 513 user, for login applications, 589–591 web services, returning data with, 545–548 writing designs, 487–488 date data, storing, 482 DATE data type, 483 date format symbols, 308–309 date() function, 308, 545 dates, 220, 307–310, 542–545 DATETIME data type, 484 db table, 463 debugging with Firebug add-on, 266–268 DECIMAL data type, 483 decimal list style, 144 default filenames, 18662 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies default root account, 458 default time zones, setting, 307–308 default values for drop-down boxes, 175–176 define statement, 287 DELETE privilege, 462 DELETE statement, 513 deleting data in databases, 513–514 databases, 490 files with PHP functions, 368–369 delimiters, 327 Denial of Service (DoS) attacks, 433 deprecated functions, 313 designing databases choosing data for, 475–477 documentation, 487–488 organizing data, 477–480 overview, 475 relationships between tables, creating, 480–481 sample, 484–487 storing different types of data, 481–484 destroying objects, 423–424 __destruct method, 423–424 detecting web browsers, 214–216 Developer’s Tools CD, 43 development environment configuring, 82–84 testing, 79–82 die statement, 385 directives, 32, 84 directories copying file into different, 368 creating with PHP, 369–370 include, 363 listing files in, 370–372 overview, 366 PHP scripts, 81 root, 366 directory handles, 370 directory listings, FTP, 380 dirname function, 367 disable-libxml option, PHP, 45 disabling form fields, 257–259 functions and classes, 637–638 disc list style, 144 diskspace, provided by web-hosting companies, 17 display code, separating from logic code, 357–358 display CSS property, 160 display_errors directive, 639 display_errors option, 428 displaying PHP content on web pages, 278–281 displaying values in PHP variables with echo statements, 284–285 knowing how long variables hold values, 286 overview, 284 with print statements, 284–285 with print_r statements, 286 with var_dump statements, 286–287 DISTINCT keyword, 505, 508 div CSS selector, 130 <div> tag, 95, 96, 126, 127–128 division, 197 division (/) sign, 290 .dll files, 74 DMG files, installing MySQL on Macs from, 62–63 DNS (Domain Name System), 9, 14 doctypes, 90–91 document object, 211, 214 Document Object Model (DOM), 210, 211–214 Document Root changing location of, 32, 33 location of, 51 Document Type Declaration (DTD), 90–91 documents, HTML block-level elements, 98 body section, 94 comments, 101–102 head section, 92–93 images, adding, 113–116Index indentation in, 102 inline elements, 98 inserting text, 95–96 line breaks, inserting, 99–101 links, adding, 108–112 lists, adding, 102–105 overview, 89–90, 91–92 root element, 92 spaces, inserting, 99–101 tables, 102–103, 105–108 title elements, 93 types of, declaring, 90–91 dollar amounts, formatting numbers as, 291 dollar sign ($), 282, 283, 405 DOM (Document Object Model), 210, 211–214 Domain Name System (DNS), 9, 14 domain names, 9 DOMDocument object, 551 DoS (Denial of Service) attacks, 433 dot (.), 294 dot notation, 208, 209 dotted border style, 141 double border style, 141 double quotes (“ “), 285 double-quoted strings, 292–294 do..while loops, 335, 341–342 downloaded files, verifying, 24–25, 39, 59 downloading Apache, from website, 23 Firebug add-on, 265 with FTP, 380–382 jQuery, 220–221 MySQL, 58 PHP, from website, 37 XAMPP installation kit, 75–76 DROP privilege, 462, 490 DROP TABLE statement, 493 DROP USER statement, 468 drop-down boxes, 170, 174–176, 431, 579–580 DTD (Document Type Declaration), 90–91 663 dynamic web applications MySQL, 12–13 PHP, 12–13 E E_ERROR keyword, 312 each() loop, 230 echo statements, 275–276, 278–281, 284–285, 287, 298 ECMA-262 specification, 188 e-commerce administration, 587 editors, text, 89, 97, 311 else section of if statements, 330 elseif section of if statements, 330 e-mail addresses PHP validation of, 581–582 provided by web-hosting companies, 17 e-mail functionality class methods, building, 628–632 overview, 618–619 password recovery page, building, 619–622 password reset database, building, 619 password reset page, building, 623–625 process files, building, 625–628 success page, building, 622–623, 625 emailPass method, 628–630 em’s, font sizing by, 136–138 enable-ftp option, PHP, 45 enable-magic-quotes option, PHP, 45 enabling FTP, 378 panels in Firebug add-on, 267 encoding, character, 119 encryption of MySQL passwords, 461 end statement, 303 ending statements, in for loops, 338 endingcondition statement, 336 ENDSTRING, 295664 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies Enterprise Server, 58 entities, database, 478 ENUM data type, 484 enumeration data, storing, 482–483 equal operator (==), 421–422 equal sign (=), 194, 282 error display, changing PHP, 639 error log, MySQL, 70 error messages access denied, 69 Can’t connect to . . ., 70 client does not support authentication protocol, 69–70 MySQL, 522–523 SQLite software, 395 undefined function, 53, 73 web services, 547 error messages, PHP, 301 displaying, 313–315 fatal errors, 312 logging, 315–316 notices, 313 operating system commands, accessing with, 376–377 overview, 310 parse errors, 311 strict messages, 313 suppressing, 315 types of, 310–311 warnings, 312 error_log option, 428 error_reporting directive, 639 errors, handling with Exception class, 419–420 escaping from HTML, 272 escaping special characters, 292, 525–526 events form, 242–247 hover event handler, adding, 251–254 keyboard, 254–259 mouse click event handler, adding, 247–251 overview, 241 types of, 241–242 Exception class, handling errors with, 419–420 exchanging PHP data with other programs, 389–391 exclamation point (!), 332–333 exec function, 372, 375–376 exec-prefix=EPREFIX option, PHP, 45 expose_php option, 428 expressions for WHERE clause, 506–507 Extensible Markup Language (XML), 541, 550–553 extensions for MySQL support, 71 external JavaScript files, 190 external style sheets, 128–129 extract function, 302 F F date format symbol, 308 F12 Developer Tools, 264 fatal errors, 311, 312 Fedora, 23, 37 feedback to form users, providing, 565–568 feof function, 387 fgets statement, 387, 388, 391 fields on web forms aligning with CSS, 180–183 malicious attacks through, 429–430 <fieldset> tag, 172 file extensions, PHP, 19 file function, 389, 391 file handles, 384 file management with PHP copying files, 368–369 deleting files, 368–369 getting information about files, 366 moving files, 368–369 overview, 366 file modes, 380 FILE privilege, 462 file system, 366Index File Transfer Protocol (FTP) directory listings, 380 downloading files with, 380–382 functions, 382–383 logging in to server, 379 overview, 378 safe uploading with, 434–436 support for, enabling, 45 uploading files with, 380–382 file_exists statement, 366 file_get_contents function, 389 file_uploads setting, 433 fileatime function, 367 filectime function, 367 filegroup function, 367 filemtime function, 367 filename extensions, verifying, 434 filenames changing in Apache, 33 default, 18 fileowner function, 367 files. See also File Transfer Protocol (FTP) accessing text files, with PHP, 384–386 Apache configuration, 83–84 binary, 23, 37, 58, 380 closing text, 386 comma-delimited, 389–391, 500 copying into different directories, 368 copying with PHP functions, 368–369 CSV, 389–391, 392–393 default filenames, 18 deleting with PHP functions, 368–369 .dll, 74 DMG, installing MySQL on Macs from, 62–63 downloaded, verifying, 24–25, 39, 59 editing configuration, 82 external JavaScript, 190 file extensions, PHP, 19 665 file management with PHP copying files, 368–369 deleting files, 368–369 getting information about files, 366 moving files, 368–369 overview, 366 file modes, 380 filename extensions, verifying, 434 flat, PHP statements for accessing files, 384–386 exchanging data in, 390 overview, 383–384 reading from, 387–390 SQLite software, 394–395 writing to, 386–387 formats for image, 115 getting information about with PHP functions, 366 .htaccess, setting PHP options in, 636 httpd.conf, 32, 47, 83–84 include, 359 installing MySQL from RPM files on Linux, 61–62 listing in directories, 370–372 modes for opening, 384 moving with PHP functions, 368–369 my.cnf, 84 MySQL configuration, 65, 84 organizing with PHP functions, 369–372 password recovery process, creating, 625–626 PHP configuration, 83 php.ini disabling functions and classes, 637–638 editing, 50–51, 53, 83 error display, changing, 639 file_uploads setting, 433 limiting file sizes in, 433 location of, 83 making changes outside of, 636 overview, 635666 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies files (continued) resource limits, changing, 639 security options, setting in, 428 session parameters, changing, 637 session timeout, changing, 636–637 troubleshooting PHP and MySQL connections, 73 working with, 635 prepended, starting sessions with, 532–534 preventing uploads to PHP, 433 process files, building, 625–628 reading into arrays, 388–389 reset process, creating, 627–628 specifying log files, 316 tab-delimited, 391–393, 500 test.php, 51–52 TSV, 391–393 uploading with FTP, 434–436 validating, 433–434 verifying downloaded, 24–25 Zip, 37, 46 filesize function, 367 filetype function, 367 filter_var() function, 581–582, 585 filtering jQuery selectors, 227 final keyword, 418 Firebug add-on debugging with, 266–268 installing, 264–266 overview, 264 Firebug console, 266 Firefox web browser, 264–268 firewalls, 426 flat files, PHP statements for accessing files, 384–386 exchanging data in, 390 overview, 383–384 reading from, 387–390 SQLite software, 394–395 writing to, 386–387 float CSS property, 160 floating-point numbers, 288, 289–291 FLUSH PRIVILEGES statement, 466 folders, 366 font family, setting, 134–136 font sizing methods, 136–137 font-family property, 134–135 fonts, styling with CSS color, setting, 138–140 font family, setting, 134–136 general discussion, 122–126 overview, 11, 134 size, setting, 136–138 font-size CSS property, 136–137 font-style property, 126 font-weight property, 126 fopen() function, 434 fopen statement, 385 for loops advanced, 337–339 building, 336 general discussion, 200–203 nesting, 336–337 overview, 335 foreach statement, 304–305, 306 form events, 241, 242–247 <form> tag, 95, 170, 172–173 form validation. See also PHP validation adding to web form, 563–565, 570–574 basic, 557–561 of check boxes, 579–580 of drop-downs, 579–580 e-mail addresses, 581–582 feedback to form users, 565–568 form validation process, 555–556 HTML, 116–119 HTML and CSS on forms, reviewing, 561–562 matching passwords, 582–584 of numbers, 580–581 overview, 555, 574–576 of radio buttons, 579–580 refining, 568–570 of required fields, 576–579 of text, 579 of URLs, 582 validation functions, creating, 585–586 of web forms, 246–247Index format symbols for dates, 308–309 formats for image files, 115 formatting dates, 308 numbers as dollar amounts, 291 forms. See also validation aligning fields with CSS, 180–183 check boxes, creating, 176–177 clearing, 180 counting characters in text boxes, 254–257 creating with OOP, 414–415 disabling form fields, 257–259 drop-down boxes, adding, 174–176 <form> tag, 172–173 general discussion, 169–170 input elements of, 170–172 malicious attacks through, 429–432 overview, 169 radio buttons, 178–179 submitting, 179–180 text inputs, adding, 173–174 unexpected input, handling, 429–432 forward slash (/), 327 front slash (/), 197 FTP (File Transfer Protocol) directory listings, 380 downloading files with, 380–382 functions, 382–383 logging in to server, 379 overview, 378 safe uploading with, 434–436 support for, enabling, 45 uploading files with, 380–382 ftp_cdup function, 382 ftp_chdir function, 382 ftp_close function, 382, 436 ftp_connect function, 379, 382, 435 ftp_delete function, 382 ftp_exec function, 382 ftp_fget function, 382 ftp_fput function, 383 ftp_get function, 380, 383, 436 ftp_login function, 383, 435 667 ftp_mdtm function, 383 ftp_mkdir function, 383 ftp_nlist function, 380, 383 ftp_put function, 381, 383, 435 ftp_pwd function, 383 ftp_rename function, 383 ftp_rmdir function, 383 ftp_size function, 383 ftp_systype function, 383 function files, creating, 591–593 function keyword, 204 functions. See also specific functions by name accessing HTML with JavaScript, 211 addNumbers, 205–207 anonymous, 225 arguments, adding, 204 calling, 204–205 creating, 204 FTP, 382–383 overview, 203–204 returning results from, 207–208 functions, PHP. See also specific functions by name built-in, 356 code reuse through, 536–539 creating, 347 deprecated, 313 disabling, 637–638 error messages, 312 file management, 365–369 include files, placing in, 360 for MySQL, 452 organizing scripts with, 358–359 overview, 319, 346 passing values to, 349–354 related to objects and classes, 422–423 returning values from, 354–356 reusing code, 358 for validation, 585–586 variables, using in, 347–349 for working with MySQL, 516 functions, SQL, 504 fwrite statement, 386668 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies G G date format symbol, 309 g date format symbol, 309 GET method, 172, 173, 548 get_class_methods function, 422 get_class_vars function, 422 get_object_vars function, 423 _getDocType method, 645 getElementById function, 211–214 _getHead() method, 645 _getHtmlOpen() method, 645 getTop() method, 644, 648 global functions, 347 global statement, 348–349 Google, use of page titles, 93 Google Maps, 188 GRANT privilege, 462 GRANT statements, 465, 466–467 GRANT tables, 473 GROUP BY, SELECT queries, 505 grSecurity, 425 H H date format symbol, 309 h date format symbol, 309 <h1> through <h6> tags, 95, 96 hardening servers, 425–426 hash values, 438 HashCheck, 39 head section, HTML documents, 92–93 <head> section of page, 643 Hello World script, 274 helper functions, automatically including, 531–535 auto_prepend_file function, 531–532 classes, using for efficiency, 534–535 overview, 531 sessions, starting with prepended files, 532–534 heredoc statement, 295 hex codes, 137–138 hiding elements with CSS, 161 hinting, type, 406 holding data in arrays, 195 in variables, 193–195 host table, 463 hosting choosing hosts, 14–15 for company websites, 15–16 hosted websites, using, 18–19 overview, 14 web-hosting companies, choosing, 16–18 hostnames, 19, 460–461 hover event handlers, 251–254 hover() function, 253 <hr> tag, 95 href attribute, 108 htdocs directory, 81 HTML (HyperText Markup Language) block-level elements, 98 comments, 101–102 converting special characters to entities, 432 creating pages, 97–98 CSS styling, adding to page elements, 122–126 CSS targeting of elements, 130 documents, 89–94 escaping from, 272 on forms, reviewing, 561–562 general discussion, 10–11 images, adding, 113–116 include files, placing in, 359 inline elements, 98 inserting text in pages, 95–96 JavaScript, working with, 189–190, 210–214 jQuery, working with, 227–232 line breaks, inserting, 99–101 links, adding, 108–112 lists, adding, 102–105 output on web pages, troubleshooting, 53 overview, 89 PHP logic, separating from, 357–358Index semantic markup, 95 spaces, inserting, 99–101 tables, 102–103, 105–108 tags, 94–95, 103 validating, 116–119 HTML5 document type, 90 htmlentities() function, 432 HTTP (HyperText Transfer Protocol), 8–9, 548 httpd.conf file, 32, 47, 83–84 HyperText Markup Language (HTML) block-level elements, 98 comments, 101–102 converting special characters to entities, 432 creating pages, 97–98 CSS styling, adding to page elements, 122–126 CSS targeting of elements, 130 documents, 89–94 escaping from, 272 on forms, reviewing, 561–562 general discussion, 10–11 images, adding, 113–116 include files, placing in, 359 inline elements, 98 inserting text in pages, 95–96 JavaScript, working with, 189–190, 210–214 jQuery, working with, 227–232 line breaks, inserting, 99–101 links, adding, 108–112 lists, adding, 102–105 output on web pages, troubleshooting, 53 overview, 89 PHP logic, separating from, 357–358 semantic markup, 95 spaces, inserting, 99–101 tables, 102–103, 105–108 tags, 94–95, 103 validating, 116–119 HyperText Transfer Protocol (HTTP), 8–9, 548 669 I i date format symbol, 309 i++ (postfix operator), 201 icon, Firebug, 266 icons, used in book, 3 id attribute, 177, 182 id selector, 130–131 identical operator (===), 421–422 if statements building, 330–332 complex statements, 277 negating, 332–333 nesting, 333 overview, 329, 330 IIS (Internet Information Services), Microsoft, 8, 19, 25, 48–49, 273 images adding to background, 150–154 changing with jQuery, 234–237 file size, 114 formats, 115 inserting in pages, 113–116 <img> tag, 95, 113–114 include files external text files, bringing into script, 360–361 include directories, setting up, 363 include statements, types of, 360 overview, 359–360 PHP tags in, 361 secure storage for, 361–362 variables, using in, 361 include statements, types of, 360 include_once statements, 360–361 increment statement, 336 indentation in HTML, 102 in PHP code, 277–278 indexes, 203 infinite loops avoiding, 343–344 with while loops, 341 infodir=DIR option, PHP, 45 inheritance, 400670 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies ini_get() function, 636 ini_set() function, 636 initUser function, 610 inline CSS, 122–126 inline elements, 98 inner joints, 510 in-page anchors, 111 input data, accepting in web services, 548–553 input elements of, 170–172 <input> tag, 95 INSERT privilege, 462 INSERT statement, 499, 602 inserting line breaks, in pages, 99–101 spaces, in pages, 99–101 text in HTML pages, 95–96 installation kit, XAMPP Control Panel, using, 78–79 installing, 76–78 obtaining, 75–76 overview, 24, 38, 59, 75 reinstalling, 84–85 testing, 79–82 troubleshooting, 85 uninstalling, 84–85 installation kits for Apache, 24 for MySQL, 59 for PHP, 38–39 Installation Type screen, 26 installing Apache, 25–28 Firebug add-on, 264–266 jQuery, 220–221 MySQL, 20, 59–65 PHP, 20, 40–46 web servers, on local computers, 19–20 XAMPP installation kit, 76–78 instanceof operator, 423 instantiation, 398, 402, 413 INT data type, 483 integer data type, 288, 289–291 interfaces, 417–418 internal style sheets, 126–128 Internet Explorer F12 Developer Tools, 264 JavaScript support, 188 Internet Information Services (IIS), Microsoft, 8, 19, 25, 48–49, 273 Internet Protocol (IP) addresses general discussion, 9 as hostnames, 460 is_dir function, 367 is_executable function, 367 is_file function, 367 is_readable function, 367 is_writable function, 367 isLoggedIn property, 612–613, 614–618 isNaN() function, 206 iteration with foreach statement, 304–305 manual, 303–304 multidimensional arrays, 306 overview, 302–303 J j date format symbol, 308 Java, 12, 187–188 JavaScript. See also jQuery alerts, sending to screen, 191–193 arrays, holding multiple values in, 195 benefits of, 188 comments, adding, 193 conditionals, 197–200 debugging with Firebug add-on, 266–268 events form, 242–247 hover event handler, adding, 251–254 keyboard, 254–259 mouse click event handler, adding, 247–251 overview, 241 types of, 241–242Index external, 190 functions, 203–208 general discussion, 11–12 HTML, working with, 189–190, 210–214 Java versus, 187–188 JavaScript tag, adding to pages, 189 for login pages, 606–607 looping, 200–203 numbers, working with, 196–197 objects, 208–210 overview, 187, 191 password recovery pages, building, 621–622 for registration pages, 596–597 strings, keeping track of words with, 195–196 troubleshooting alerts, 191–193, 262 comments, 262–264 Firebug add-on, 264–268 overview, 261 validation adding to web form, 563–565, 570–574 basic, 557–561 feedback to form users, 565–568 HTML and CSS on forms, reviewing, 561–562 overview, 556 refining, 568–570 variables, holding data in, 193–195 web browsers, working with, 214–217 JavaScript Object Notation (JSON), 541, 542–545, 551–553 JavaScript tag, adding to pages, 189 JavaScript validation adding to web form, 563–565, 570–574 basic, 557–561 feedback to form users, 565–568 HTML and CSS on forms, reviewing, 561–562 671 overview, 556 refining, 568–570 JOIN query, 510–513 joining multiple comparisons, 327–329 joining strings, 196, 294 jQuery. See also events CDN-hosted, adding to pages, 222–223 CSS, changing, 237–240 general discussion, 219–220 HTML, working with, 227–232 HTML attributes, setting, 232–237 installing, 220–221 local, adding to pages, 221–222 overview, 214, 219 ready() function, 223–225 selecting elements with, 225–227 JSON (JavaScript Object Notation), 541, 542–545, 551–553 json_decode() PHP function, 544–545 K keyboard events counting characters in text boxes, 254–257 overview, 241 preventing character input, 257–259 key/value pairs, 297 keywords DISTINCT, 505, 508 E_ERROR, 312 final, 418 function, 204 LIMIT, 505, 508 private, 404 protected, 404 public, 404 return, 207 var, 193–194 krsort function, 301 ksort function, 301672 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies L l date format symbol, 309 <label> tag, 172 language options, XAMPP web page, 80 <legend> tag, 172 length property, 202 <li> tag, 103 LIMIT keyword, 505, 508 line breaks, inserting in pages, 99–101 line numbers in script, 311 lines, separating in PHP code, 280–281 <link> tag, 95, 128–129 links absolute versus relative, 111 adding to page, 108–109 opening in new windows, 112 to other pages, creating, 109–110 overview, 108 within pages, creating, 111–112 password recovery page, adding to, 621 Linux activating MySQL support, 71–72 Apache, installing on, 19 backing up databases on, 469–471 case sensitivity with SQL, 452 checking for MySQL on, 56 checking for PHP installation on, 36 configuring Apache for PHP, 49 controlling MySQL server, 67 getting Apache information on, 31 installing Apache from source code on, 27–28 installing MySQL from RPM files, 61–62 installing MySQL on, 20 installing PHP on, 40–42, 44–45 obtaining Apache for, 23–24 obtaining MySQL for, 58–59 obtaining PHP for, 37–38 PHP, installing on, 20 restarting Apache on, 30 starting Apache on, 29–30 starting MySQL on, 57 stopping Apache on, 30 text editors, 97 troubleshooting PHP and MySQL connections, 73 list function, 302 lists creating in HTML, 102–105 of directory files, creating, 370–372 styles, 144–147 list-style-type CSS properties, 144 literal characters, 323–326 LOAD DATA INFILE statement, 501 LOAD statement, 498–502 local jQuery, adding to pages, 221–222 local time, setting, 307–308 local variables, 347 location object, 216–217 location options, configure command, 43 log out pages, building, 614–618 log_errors option, 428 logging in to FTP server, 379 logging PHP error messages, 315–316 logic code, separating from display code, 357–358 login applications authenticated pages, adding, 612–618 e-mail functionality class methods, building, 628–632 overview, 618–619 password recovery page, building, 619–622 password reset database, building, 619 password reset page, building, 623–625 process files, building, 625–628 success page, building, 622–623, 625Index function files, creating, 591–593 general discussion, 588 login pages, building, 604–607 overview, 587 success pages, building, 602–604 user database, creating, 589–591 User objects, creating, 607–611 web forms, creating, 593–602 login names, 460 login pages, 523–524, 604–607 long strings, storing, 295 loops breaking out of, 344–346 do..while loops, 341–342 each() loops, 230 for, 200–203, 335–339 infinite, avoiding, 343–344 overview, 200, 319, 335 while loops, 203, 338–341 M M date format symbol, 308 m date format symbol, 308 Macs activating MySQL support, 71–72 Apache, installing on, 19 backing up databases on, 469–471 checking for MySQL on, 56 checking for PHP installation on, 36 configuring Apache for PHP, 49 controlling MySQL server, 67 getting Apache information on, 31 installing Apache on, 27–28 installing MySQL from DMG files, 62–63 installing MySQL on, 20 installing PHP on, 20, 42–45 obtaining Apache for, 24 obtaining MySQL for, 59 obtaining PHP for, 38 restarting Apache on, 30 starting Apache on, 29–30 stopping Apache on, 30 673 text editors, 97 troubleshooting PHP and MySQL connections, 73 magic quotes feature, 525–526 mail() function, 630 maintainance of PHP scripts, 357 make command, 28 malicious attacks, 429–432, 433 MAMP installation kit, 24, 39 mandir=DIR option, PHP, 45 manually shutting down MySQL server, 67 manually traversing arrays, 303–304 margin CSS property, 157, 158 markup, semantic, 11, 95 master class, 400 mathematical operations on database columns, 503 max_execution_time directive, 639 maxCharacters variable, 256 maxsize attribute, 173 MD5 signatures, 39 members-only websites authenticated pages, adding, 612–618 e-mail functionality class methods, building, 628–632 overview, 618–619 password recovery page, building, 619–622 password reset database, building, 619 password reset page, building, 623–625 process files, building, 625–628 success page, building, 622–623, 625 function files, creating, 591–593 general discussion, 588 login pages, building, 604–607 overview, 587 success pages, building, 602–604 user database, creating, 589–591 User objects, creating, 607–611 web forms, creating, 593–602674 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies memory_limit directive, 639 meta elements, 93 method attribute, 172 methods. See also specific methods by name abstract, 415–418 adding to classes, 405–407 choosing for OOP scripts, 401–402 class, building, 628–632 __clone, 420–421 __construct, 410 constructor, writing, 409–410 __destruct, 423–424 emailPass, 628–630 GET, 172, 173, 548 _getDocType, 645 _getHead(), 645 _getHtmlOpen(), 645 getTop(), 644, 648 overview, 399–400 POST, 172, 173, 548 preventing changes to, 418 private, 407–409, 632 public, 407–409 _resetPass, 632 validateReset(), 630–631 mice click event handler, adding, 247–251 hover event handler, adding, 251–254 overview, 241 Microsoft Internet Information Services (IIS), 8, 19, 25, 48–49, 273 Microsoft Virtual PC for Application Compatibility software, 122 Microsoft Windows. See also XAMPP installation kit activating MySQL support, 71 Apache, installing on, 19 backing up databases on, 469 checking for MySQL on, 56 checking for PHP installation on, 36 configuring web server for PHP, 47–48 controlling MySQL server, 66–67 getting Apache information on, 31 installing Apache on, 25–26 installing MySQL on, 20 installing PHP on, 20, 46 MySQL Setup Wizard, running on, 60–61 obtaining Apache for, 23 obtaining MySQL for, 58 obtaining PHP for, 37 starting and stopping Apache on, 28–29 starting MySQL on, 57 text editors, 97 troubleshooting PHP and MySQL connections, 73, 74 minus sign (-), 197, 290 mkdir function, 369–370 mobile devices, 10 mod_security, 427 mod_so module, 40, 42 modes for opening files, 384 modulus (%) sign, 290 mouse events click event handler, adding, 247–251 hover event handler, adding, 251–254 overview, 241 moving files with PHP functions, 368–369 multidimensional arrays, 305–306 multi-line comments, 263 multiple comparisons, joining, 327–329 multiple inheritance, 400 multiple_query function, 520 multiplication, 197 multiplication (*) sign, 290 my.cnf file, 84 MySQL accounts adding, 465 administrator responsibilities regarding, 458 attributes of, 459 names of, 460–461 overview, 455, 462, 464 passwords, 461, 465–466Index privileges, 461–462, 466–467 removing, 467–468 viewing information about, 464 activating support for, 71–72 administration program for, 70 administrator responsibilities, 457–458 backing up databases, 468–471 checking for installation of, 55–56 communicating with, 450–454 configuring, 65, 84 controlling access to data, 459–462 controlling server, 66–67 database structure, 450 default root account, 458 downloading, 58 errors, handling with PHP, 522–523 function of, 449–450 general discussion, 12–13 installing, 20, 59–65 location of databases, 19 mysqli functions, 523–526 mysqli functions, converting to mysql functions, 526–527 obtaining, 57–59 overview, 449, 457 PHP communication with, 516–521 PHP scripts, working with, 515–516 protecting databases, 454–455 provided by web-hosting companies, 16 restoring data, 471–473 running as service, 85 selecting databases with PHP, 521 server, connecting to, 517–519 SQL statements, sending to server, 519 starting, 56–57 testing, 68–69 troubleshooting connections with PHP, 73–74 troubleshooting installation, 69–70 upgrading, 473 XAMPP Control Panel, starting and stopping with, 78–79 675 mysql client, 68–69, 452, 453 mysql database, 463, 464 mysql extension, 71 mysql functions converting mysqli functions to, 526–527 overview, 516 selecting databases with, 521 MySQL server, 449–450 MySQL Setup Wizard, running on Windows, 60–61 MySQL website, downloading software from, 58 MySQL Workbench, 70 mysql_select_db function, 521 mysql_upgrade script, 473 mysqladmin utility, 67 mysqldump utility program, 469 mysqli extension, 71 mysqli functions converting to mysql functions, 526–527 error messages, handling, 522–523 overview, 516 types of, 523–526 mysqli_affected_rows function, 525 mysqli_connect function, 517–518 mysqli_error function, 522–523 mysqli_insert_id function, 524 mysqli_num_rows function, 523–524 mysqli_query() function, 522 mysqli_real_escape_string function, 526 mysqli_real_escape_string() function, 602 mysqli_select_db function, 521 myVariable variable, 194 N n date format symbol, 308 name attribute, 112, 177, 178 names of accounts, MySQL, 460–461676 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies naming PHP constants, 288 PHP functions, 359 PHP variables, 282 variables, 195 navigator object, 214–215 negating if statements, 332–333 nesting foreach statements, 306 if statements, 333 queries, 503 Net Panel, Firebug add-on, 267 next statement, 303 none list style, 144, 146–147 Notepad, 97 notices, 311, 313 NULL data type, 288, 296 number_format statement, 291 numbering of script lines, 311 numbers comparing values in PHP, 321 PHP validation of, 580–581 working with in JavaScript, 196–197 numeric data types arithmetic operations on, 289 arithmetic operators, 290–291 formatting numbers as dollar amounts, 291 numerical data, storing, 482 O object data types, 288 object-oriented programming (OOP). See also classes abstract methods, 415–418 classes, 398–399, 413–415 code reuse through, 539 comparing objects, 421–422 copying objects, 420–421 destroying objects, 423–424 developing scripts, 400–402 errors, handling with Exception class, 419–420 functions related to objects and classes, 422–423 inheritance, 400 methods, 399–400 objects, 398–399 overview, 397–398 preventing changes to classes or methods, 418 properties, 399 objects choosing for OOP scripts, 401–402 comparing, 421–422 copying, 420–421 creating, 208–209, 413 creating and using in OOP scripts, 402 destroying, 423–424 getting information about, 422–423 overview, 208, 398–399 properties, adding to, 209–210 offsite storage of database backups, 468 <ol> tag, 103 on() function, 255 OOP (object-oriented programming). See also classes abstract methods, 415–418 classes, 398–399, 413–415 code reuse through, 539 comparing objects, 421–422 copying objects, 420–421 destroying objects, 423–424 developing scripts, 400–402 errors, handling with Exception class, 419–420 functions related to objects and classes, 422–423 inheritance, 400 methods, 399–400 objects, 398–399 overview, 397–398 preventing changes to classes or methods, 418 properties, 399 open_basedir option, 428Index opendir statement, 370–372 opening files, modes for, 384 opening tags, 91 operating system commands backticks, 373–374 error messages, accessing with, 376–377 exec function, 375–376 overview, 372–373 passthru function, 376 security issues, 377–378 system function, 374–375 operating systems Linux activating MySQL support, 71–72 Apache, installing on, 19 backing up databases on, 469–471 case sensitivity with SQL, 452 checking for MySQL on, 56 checking for PHP installation on, 36 configuring Apache for PHP, 49 controlling MySQL server, 67 getting Apache information on, 31 installing Apache from source code on, 27–28 installing MySQL from RPM files, 61–62 installing MySQL on, 20 installing PHP on, 40–42, 44–45 obtaining Apache for, 23–24 obtaining MySQL for, 58–59 obtaining PHP for, 37–38 PHP, installing on, 20 restarting Apache on, 30 starting Apache on, 29–30 starting MySQL on, 57 stopping Apache on, 30 text editors, 97 troubleshooting PHP and MySQL connections, 73 Macs activating MySQL support, 71–72 Apache, installing on, 19 backing up databases on, 469–471 677 checking for MySQL on, 56 checking for PHP installation on, 36 configuring Apache for PHP, 49 controlling MySQL server, 67 getting Apache information on, 31 installing Apache on, 27–28 installing MySQL from DMG files, 62–63 installing MySQL on, 20 installing PHP on, 20, 42–45 obtaining Apache for, 24 obtaining MySQL for, 59 obtaining PHP for, 38 restarting Apache on, 30 starting Apache on, 29–30 stopping Apache on, 30 text editors, 97 troubleshooting PHP and MySQL connections, 73 Unix backing up databases on, 469–471 case sensitivity with SQL, 452 checking for MySQL on, 56 checking for PHP installation on, 36 getting Apache information on, 31 installing PHP on, 40–42, 44–45 obtaining MySQL for, 58–59 restarting Apache on, 30 starting Apache on, 29–30 stopping Apache on, 30 Windows activating MySQL support, 71 Apache, installing on, 19 backing up databases on, 469 checking for MySQL on, 56 checking for PHP installation on, 36 configuring web server for PHP, 47–48 controlling MySQL server, 66–67 getting Apache information on, 31 installing Apache on, 25–26 installing MySQL on, 20 installing PHP on, 20, 46678 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies operating systems (continued) MySQL Setup Wizard, running on, 60–61 obtaining Apache for, 23 obtaining MySQL for, 58 obtaining PHP for, 37 starting and stopping Apache on, 28–29 starting MySQL on, 57 text editors, 97 troubleshooting PHP and MySQL connections, 73, 74 operating systems, PHP tasks on exchanging data with other programs, 389–391 file management, 365–369 FTP, 378–383 operating system commands, 372–378 organizing files, 369–372 overview, 365 reading and writing text files, 383–389 SQLite software, 394–395 or, in comparisons, 327–329 order, retrieving database data in, 505 ORDER BY, SELECT queries, 505 order for passing values to functions, 351 ordered lists, 103, 104–105 organizing data in databases, 477–480 files with PHP functions, 369–372 organizing PHP scripts display code, separating from logic code, 357–358 with functions, 358–359 with include files, 359–363 overview, 357 reusing code, 358 outer joints, 510 P <p> tag, 95, 96 padding, 143–144, 158 Page class, 642–643 page events, 241 page layouts, CSS overview, 155 single-column layout, creating, 155–158 two-column layout, creating, 159–162 paid access to websites, 587 panels, enabling in Firebug add-on, 267 parent classes, 400, 415–417 parentheses using with arithmetic operators, 290–291 using with comparisons, 329 parse errors, 311 passing values to PHP functions number of, 351–352 order of, 351 overview, 349–350 by reference, 353–354 types of values, 350–351 passthru function, 372, 376 password recovery e-mail success page, 622–623 password recovery pages, building, 619–622 password recovery process file, creating, 625–626 password reset database, building, 619 password reset pages, building, 623–625 passwords MySQL accounts, 461, 465–466 PHP validation of, 582–584 root account, 458 pathinfo() function, 368Index paths, changing in Apache, 33 pattern matching with regular expressions, 323–327 percentages, font sizing by, 136–137 periods (.), 132 Perl-compatible regular expressions, 323 permissions, MySQL accounts, 455 .php extension, 272 PHP functions. See also specific functions by name built-in, 356 code reuse through, 536–539 creating, 347 deprecated, 313 disabling, 637–638 error messages, 312 file management, 365–369 include files, placing in, 360 for MySQL, 452 organizing scripts with, 358–359 overview, 319, 346 passing values to, 349–354 related to objects and classes, 422–423 returning values from, 354–356 reusing code, 358 for validation, 585–586 variables, using in, 347–349 for working with MySQL, 516 PHP HyperText Preprocessor (PHP). See also data types; object- oriented programming Apache, securing, 426–427 arrays $_SESSION, 438 creating, 296–297 getting values from, 301–302 holding multiple values in, 195 for loops, 202–203 multidimensional, 305–306 overview, 288, 296 reading files into, 388–389 679 removing values from, 299 sorting, 299–301 viewing, 298–299 walking through values in, 302–305 checking for installation, 36 comments, adding to script, 316–318 configuring, 50–51, 83 configuring for MySQL support, 71 configuring web server for, 47–49 constants, 287–288 cookies, 438–440 dates and times, 307–310 displaying content on web pages, 278–281 error messages, 310–316 file extensions, 19 general discussion, 12–13, 271–273 helper functions, automatically including, 531–535 installing, 20, 35, 40–46 obtaining, 36–39 OOP. See also classes abstract methods, 415–418 classes, 398–399, 413–415 code reuse through, 539 comparing objects, 421–422 copying objects, 420–421 destroying objects, 423–424 developing scripts, 400–402 errors, handling with Exception class, 419–420 functions related to objects and classes, 422–423 inheritance, 400 methods, 399–400 objects, 398–399 overview, 397–398 preventing changes to classes or methods, 418 properties, 399680 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies PHP HyperText Preprocessor (PHP) (continued) operating systems tasks exchanging data with other programs, 389–391 file management, 365–369 FTP, 378–383 operating system commands, 372–378 organizing files, 369–372 overview, 365 reading and writing text files, 383–389 SQLite software, 394–395 overview, 271, 531 provided by web-hosting companies, 16 registration-process pages, 598–602 reusing code, 535–539 sanitizing variables, 432–436 securing servers, 425–426 security options, setting in php.ini, 428 sessions, 437–438, 440–446 structure of, 273–275 PHP HyperText Preprocessor (PHP) syntax, 275–277 templates, 642–650 testing, 51–52, 81–82 troubleshooting connections with MySQL, 73–74 troubleshooting installation of, 53 unexpected input, handling, 429–432 validation of check boxes, 579–580 of drop-downs, 579–580 e-mail addresses, 581–582 matching passwords, 582–584 of numbers, 580–581 overview, 574–576 of radio buttons, 579–580 of required fields, 576–579 of text, 579 of URLs, 582 validation functions, creating, 585–586 variables assigning strings to, 292 assigning values to, 282–283 creating, 282–283 displaying values in, 284–287 naming, 282 overview, 281 removing information from, 283 session, 437–438 single versus double quotes with, 293 testing content of, 322 timestamps, assigning to, 309–310 using in functions, 347–349 variable, 283–284 writing code, 277–278 PHP scripts breaking out of loops, 344–346 communicating with MySQL, 516–521 conditional statements, 329–335 conditions, setting up comparing values, 320–322 joining multiple comparisons, 327–329 overview, 320 pattern matching with regular expressions, 323–327 testing variable content, 322 display code, separating from logic code, 357–358 do..while loops, 341–342 include files, organizing with, 359–363 infinite loops, avoiding, 343–344 for loops, 335–339 MySQL, working with, 515–516 MySQL errors, handling, 522–523 mysqli functions, 523–526 mysqli functions, converting to mysql functions, 526–527 organizing, 357 overview, 319–320 reusing code, 358 selecting MySQL databases with, 521 while loops, 338–341 PHP tags, 273, 361Index PHP validation of check boxes, 579–580 of drop-downs, 579–580 e-mail addresses, 581–582 matching passwords, 582–584 of numbers, 580–581 overview, 574–576 of radio buttons, 579–580 of required fields, 576–579 of text, 579 of URLs, 582 validation functions, creating, 585–586 PHP website, downloading from, 37 php_value directive, 636 phpinfo() output, 74 php.ini file disabling functions and classes, 637–638 editing, 50–51, 53, 83 error display, changing, 639 file_uploads setting, 433 limiting file sizes in, 433 location of, 83 making changes outside of, 636 overview, 635 resource limits, changing, 639 security options, setting in, 428 session parameters, changing, 637 session timeout, changing, 636–637 troubleshooting PHP and MySQL connections, 73 working with, 635 phpMyAdmin utility, 24, 81 pixels, font sizing by, 136–137 plus sign (+), 196, 289, 290 points, font sizing by, 136–137 port used by Apache, changing, 32, 33 POST method, 172, 173, 548 postfix operator (i++), 201 PostgreSQL databases, enabling support for, 45 pound sign (#), 131, 173 prefix=PREFIX option, PHP, 45 preg_match() function, 326–327, 430, 431, 553 681 prepended files, starting sessions with, 532–534 preventDefault() function, 246 previous statement, 303 primary key, 479, 491 primary selectors, jQuery, 226 print statements, 278–281, 284–285 print_r statements, 286, 298 private keyword, 404 private properties and methods, 407–409, 632 privileges, MySQL accounts, 459, 461–462, 463, 466–467 process files, building, 625–628 programs exchanging PHP data with other, 389–391 provided by web-hosting companies, 17 server-side, 12 TextEdit, 97 web server, 8 properties $this variable, accessing with, 404–405 adding to objects, 209–210 background-color, 147 background-image, 150–154 background-position, 153 choosing for OOP scripts, 401–402 clear, 157 display, 160 float, 160 font-family, 134–135 font-size, 136–137 font-style, 126 font-weight, 126 isLoggedIn, 612–613, 614–618 length, 202 list-style-type, 144 margin, 157, 158 overview, 399 private, 407–409 property_exists, 422 public, 407–409 setting for classes, 403–404682 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies properties (continued) text-decoration, 167 userAgent, 215–216 visibility, 161 width, 157 property_exists function, 422 protected keyword, 404 protecting databases, 454–455 protocol, HTTP, 8–9 provideFeedback function, 566, 569–570 public keyword, 404 public properties and methods, 407–409 Q queries, SQL building, 451–452 to see account information, 464 sending, 452–454 querying PHP data types, 289 R r mode, 384 r+ mode, 384 radio buttons, 170, 178–179, 431, 579–580 RDBMS (Relational Database Management System), 13, 450, 477–480 read mode, opening files in, 385 readdir function, 370, 371 reading CSV files, 391 text files, with PHP, 387–390 ready() function, 223–225, 241, 246 real numbers, 289–291 redirecting to other pages, 216–217 referencing image locations, 113–114 passing values to functions by, 353–354 refining validation, 568–570 register_globals setting, 428, 434 registerUser function, 602 registration pages creating, 593–596 CSS, 597–598 JavaScript, 596–597 registration-process PHP pages, 598–602 regular expressions, 323–327, 430, 579 reinstalling XAMPP installation kit, 84–85 Relational Database Management System (RDBMS), 13, 450, 477–480 relationships between database tables, creating, 480–481 relative versus absolute links, 111 reliability of web-hosting companies, 16 Remember icon, 3 removeAttr() function, 259 removeClass function, 239–240 removeFeedback function, 566, 570 removing information from PHP variables, 283 MySQL accounts, 467–468 tables from databases, 493 values from arrays, 299 rename statement, 369 repeating background images, 154 request verification, 459 require statements, 360 require_once statements, 361 required fields, PHP validation of, 576–579 Reset button, adding to web forms, 180 reset process file, creating, 627–628 reset statement, 303 reset success pages, 625 _resetPass method, 632 resizing images, 114 resource data types, 288 resource limits, changing, 639 restart command, 30 restarting Apache, 29, 30 restoring data from backups, 471–473Index results from functions, returning, 207–208 retrieving data from databases combining data from separate tables, 508–513 overview, 502–503 specific information, 503–504 in specific orders, 505 from specific rows, 505–508 return keyword, 207 return statement, 347, 354–356 returning results from functions, 207–208 values from PHP functions, 354–356 reusing PHP code, 358, 535–539 REVOKE statement, 467 root account, 458 root directory, 366 root element, HTML documents, 92 rows counting number affected by statements, 525 counting number retrieved by queries, 523–524 retrieving database data from, 505–508 RPM files, installing MySQL on Linux from, 61–62 rsort function, 301 rtrim function, 388 S s date format symbol, 309 safe_mode option, 428 safe_mode_gid option, 428 sanitizing user input, 430 <script> tag, 95, 189 search engines, use of page titles, 93 search function, 356 security Apache, 14 backing up databases, 468–471 FTP, 378 include files, 361–362 683 MySQL, 454–455, 518 operating system command issues, 377–378 security, PHP Apache, securing, 426–427 overview, 425 sanitizing variables, 432–436 securing servers, 425–426 setting in php.ini, 428 unexpected input, handling, 429–432 select boxes, adding to web forms, 174–176 SELECT privilege, 462 SELECT query, 502–505, 508–513 SELECT statement, 631 selected attribute, 175, 176 selecting elements with jQuery, 225–227 selectors, CSS groups of elements as, 131–134 individual elements as, 130–131 overview, 128–129 selecting HTML elements, 130 selectors, jQuery, 225–227 SELinux, 425 semantic markup, 11, 95 SERIAL data type, 484 servers. See also web hosting Apache advantages of, 14 checking version of, 42 configuring, 32–33, 83–84 configuring for PHP, 47–48, 49 getting information on, 31 installing on local computers, 19–20 installing PHP on Linux or Unix with, 41 obtaining, 22–24 overview, 8, 21, 273 PHP compatability with, 273 running as service, 85 securing, 426–427 starting and stopping, 28–30684 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies servers (continued) testing web servers, 21–22 verifying downloaded files, 24–25 version of, checking, 41 XAMPP Control Panel, starting and stopping with, 78–79 configuring for PHP, 47–49 defined, 7 FTP, logging in to, 379 general discussion, 8–9 HTML documents, storing on, 89–90 installing, 25–28 installing on local computers, 19–20 PHP files, processing of, 271–272 securing, 425–426 testing for, 21–22 server-side programs, 12 server-side validation, 555, 556 Service check box, XAMPP Control Panel, 85 servlet support, including, 45 session cookies, 637 session_destroy function, 446, 614 session_id function, 446 session_name function, 446 session_start() function, 440–441, 532 session_write_close() function, 445 sessions closing, 445 options for, 446 overview, 437–438 parameters, changing, 637 prepended files, starting with, 532–534 session_write_close() function, 445 starting, 440–445 timeout, changing, 636–637 SET PASSWORD statement, 466 set_time_limit() function, 639 setcookie() function, 438–439 setSession() function, 610 setTimeout() function, 236 SHUTDOWN privilege, 462 shutting down MySQL server, 67 signatures abstract methods, 416 MD5, 39 simple statements, 276–277 single line comments, 263 single quote (’), 292 single quotes (‘ ‘), 285 single-column fixed-width layout, 155–158 single-column liquid layout, 157–158 single-quoted strings, 292–294 site maps, 163 size of font, setting with CSS, 136–138 of images, 114 size attribute, 173 software exchanging PHP data with other, 389–391 provided by web-hosting companies, 17 server-side, 12 TextEdit, 97 web server, 8 solid border style, 141 sort function, 299–300, 301 sorting arrays, 299–301 source code installing Apache from, 23–24, 27–28 installing MySQL from, 63–65 installing PHP from, 38 output from PHP statements, 279 spaces avoiding in filenames and URLs, 110 inserting in pages, 99–101 in SQL, 452 <span> tag, 95, 126, 127 special characters -, 324 ( ), 324 ( | | ), 324 ?, 324 ^, 324 { , }, 324Index changing in Apache, 33 converting to entities, 432 escaping, 525–526 used in patterns, 323–326 specifying log files, 316 speed of web-hosting companies, 17 SQL (Structured Query Language), 451 queries, 451–454, 464 SQL injection, 429–430 statements, sending to MySQL, 519 SQL injection, 429–430 SQLite software, 394–395 sqlite_query function, 394–395 square brackets ([ ]), 296 square list style, 144 src attribute, 113, 190, 234 starting Apache, 29–30 startingvalue statement, 336 Startup Wizard, XAMPP, 76–78 statements AddType, 47–48, 49 beginning statements, in for loops, 337 break, 334, 335, 344–346 class, 402, 403 complex, 276–277, 319 continue, 344–346 echo, 275–276, 278–281, 284–285, 287, 298 else section of if statements, 330 elseif section of if statements, 330 ending statements, in for loops, 338 GRANT, 465, 466–467 if statements, 277, 329, 330–333 include, types of, 360 include_once, 360–361 print, 278–281, 284–285 print_r, 286, 298 require, 360 require_once, 361 simple, 276–277 SQL, sending to MySQL, 519 685 switch, 329, 333–335 var_dump, 286–287, 289, 298 statistics, provided by web-hosting companies, 17 stopping Apache, 29, 30 storage data types, 481–484 of database backups, 468 of include files, 361–362 strict messages, 311, 313 strings assigning to variables, 292 comparing, 321 defined, 288 double-quoted, 292–294 joining, 294 keeping track of words with, 195–196 overview, 288, 292 reading files into, 389 single-quoted, 292–294 SQL queries, 452 storing long, 295 strtotime statement, 309–310 structure of databases, 494–495 MySQL, 450 of PHP, 273–275 structure of HTML documents body section, 94 head section, 92–93 overview, 91–92 root element, 92 title elements, 93 Structured Query Language (SQL) queries, 451–454, 464 SQL injection, 429–430 statements, sending to MySQL, 519 <style> element, 127 style sheets external, 128–129 internal, 126–128 subclasses, 400 subdomains, 9 submit event handler, 242–246, 563686 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies submit() function, 246, 568–569 submit input type, 179 submit type, 170 submitting web forms, 179–180, 182 subqueries, 503 substr() function, 231 subtraction, 197 success pages, building, 602–607, 622–623, 625 SuExec, 426–427 support for MySQL, 71–72 suppressing single error messages, 315 switch statements, 329, 333–335 syntax, for mysql and mysqli functions, 527 syntax, PHP complex statements, 276–277 overview, 275–276 simple statements, 276–277 system function, 372, 374–375, 377 T tab-delimited files, 391–393, 500 <table> tag, 103 tables adding to databases, 491 combining data from database, 508–513 creating relationships between database, 480–481 database, 450 HTML, 102–103, 105–108 RDBMS, 477–480 tables_priv table, 463 tabs, in PHP code, 293 tab-separated values (TSV) files, 391–393 tags <a>, 94, 108–109, 111–112 anchor, 94, 108–109, 111–112 <br>, 94, 99–100 closing, 91 <div>, 95, 96, 126, 127–128 <fieldset>, 172 <form>, 95, 170, 172–173 <h1> through <h6>, 95, 96 <hr>, 95 HTML, 94–95, 103 <img>, 95, 113–114 <input>, 95 JavaScript, adding to pages, 189 <label>, 172 <legend>, 172 <li>, 103 <link>, 95, 128–129 <ol>, 103 opening, 91 opening and closing, 91 <p>, 95, 96 PHP, 273, 361 <script>, 95, 189 <span>, 95, 126, 127 <table>, 103 <td>, 103 <th>, 103 <tr>, 103 <ul>, 103 tarballs, 27, 41, 43, 62, 64 target attribute, 112 targeting CSS styles background colors, changing, 147–150 groups of elements, 131–134 individual elements, 130–131 overview, 128–129 selecting HTML elements, 130 <td> tag, 103 Technical Stuff icon, 3 technical support of web-hosting companies, 17 templates bottom of page, 646 connecting top, middle, and bottom, 646–650 extending, 650–653 general discussion, 641–642 overview, 641 template class, creating, 642–643 top of page, 643–646Index testing with conditionals, 197–200 CSS accross multiple browsers, 122–123 MySQL, 68–69 PHP, 51–52 for unexpected input on forms, 430–431 variable content, 322 for web servers, 21–22 XAMPP installation kit, 79–82 test.php file, 51–52 text changing with each() loops, 230–232 fonts, styling with CSS color, setting, 138–140 font family, setting, 134–136 general discussion, 122–126 overview, 11, 134 size, setting, 136–138 inserting in HTML pages, 95–96 PHP validation of, 579 text boxes counting characters in, 254–257 creating, 254–255 preventing character input, 257–259 TEXT data type, 483 text editors, 89, 97 text files, PHP statements for accessing files, 384–386 exchanging data in text files, 390 overview, 383–384 reading from, 387–390 SQLite software, 394–395 writing to, 386–387 text() function, 231 text inputs, adding to web forms, 173–174 text strings, 452 text type, 170 text-decoration CSS property, 167 TextEdit program, 97 <th> tag, 103 687 throwing an exception, 419–420 time data, storing, 482 TIME data type, 483 time zones, setting, 83, 307–308 timeout value for sessions, 443, 636–637 times, 307–310 timestamps, 307, 309–310 Tip icon, 3 title elements, HTML documents, 93 TLD (Top-Level Domain), 9 toggleClass function, 240 tokens, 311 top of page, in templates, 643–646 Top-Level Domain (TLD), 9 totalRemaining variable, 256 <tr> tag, 103 traversing arrays with foreach statement, 304–305 manually, 303–304 multidimensional arrays, 306 overview, 302–303 troubleshooting JavaScript programs alerts, 191–193, 262 comments, 262–264 Firebug add-on, 264–268 overview, 261 MySQL installation, 69–70 PHP and MySQL connections, 73–74 PHP installation, 53 with var_dump statements, 286–287 XAMPP installation kit, 85 try block, 420 TSV (tab-separated values) files, 391–393 turning off error messages, 313–314 Twitter, 541 two underscores (__), 407 two-column fixed-width layout, 159–161 two-column liquid layout, 161–162 type hinting, 406688 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies U <ul> tag, 103 undefined function error message, 53, 73 uninstalling XAMPP installation kit, 84–85 UNION query, 509–510 Unix backing up databases on, 469–471 case sensitivity with SQL, 452 checking for MySQL on, 56 checking for PHP installation on, 36 getting Apache information on, 31 installing PHP on, 40–42, 44–45 obtaining MySQL for, 58–59 restarting Apache on, 30 starting Apache on, 29–30 stopping Apache on, 30 Unix timestamps, 307, 367, 368 unlink statement, 369 unordered lists, 103–104, 228 UPDATE privilege, 462 UPDATE statement, 513, 525 updating database data, 513 MySQL, 458 upgrading MySQL, 473 upload_max_filesize directive, 639 uploading with FTP, 380–382, 434–436 limiting file sizes in php.ini, 433 preventing, to PHP, 433 upper-roman list style, 144 url_fopen setting, 434 URLs opening PHP files through, 274 PHP validation of, 582 USAGE privilege, 462 user accounts, MySQL adding, 465 administrator responsibilities regarding, 458 attributes of, 459 names of, 460–461 overview, 462, 464 passwords, 461, 465–466 privileges, 461–462, 466–467 removing, 467–468 seeing information about, 464 User class, building, 607–610 user database for login applications accessing, 591 building, 590–591 designing, 589–590 overview, 589 user hijacking, 430 User objects, creating, 607–611 user table, 463 userAgent property, 215–216 usort function, 301 utilities antivirus, 434 apxs, 40, 42, 43, 44 mysqladmin, 67 mysqldump, 469 phpMyAdmin, 24, 81 yum, 23, 37 V val() function, 246–247 validateForm() function, 564, 568–569 validateReset() method, 630–631 validation adding to web form, 563–565, 570–574 basic, 557–561 of check boxes, 579–580 of drop-downs, 579–580 e-mail addresses, 581–582 feedback to form users, 565–568 of files, 433–434 form validation process, 555–556 HTML, 116–119 HTML and CSS on forms, reviewing, 561–562 matching passwords, 582–584 of numbers, 580–581Index overview, 555, 574–576 of radio buttons, 579–580 refining, 568–570 of required fields, 576–579 of text, 579 of URLs, 582 validation functions, creating, 585–586 of web forms, 246–247 validation functions, creating, 585–586 value attribute, 173–174 values assigning to PHP variables, 282–283 displaying in PHP variables, 284–287 knowing how long variables hold, 286 passing to PHP functions, 349–354 removing from arrays, 299 retrieving from arrays, 301–302 returning from PHP functions, 354–356 walking through in arrays, 302–305 var keyword, 193–194 var_dump statements, 286–287, 289, 298 VARCHAR data type, 483 variable variables, 283–284 variables condition, 200 holding data in, 193–195 for loops, 200 postfix operator (i++), 201 sanitizing, 432–436 variables, PHP assigning strings to, 292 assigning values to, 282–283 creating, 282–283 displaying values in, 284–287 naming, 282 overview, 281 removing information from, 283 session, 437–438 single versus double quotes with, 293 689 testing content of, 322 timestamps, assigning to, 309–310 using in functions, 347–349 variable, 283–284 verifying downloaded files, 24–25, 39, 59 versions of Apache, 22–23, 41, 42 viewing arrays, 298–299 virtual hosts, 427 Virtual PC for Application Compatibility software, Microsoft, 122 visibility CSS property, 161 Visibone’s Color Lab, 138 W W date format symbol, 309 w mode, 384 w+ mode, 384 W3C Markup Validation Service, 116–119 walking through arrays, 302–305, 306 with foreach statement, 304–305 manually, 303–304 multidimensional arrays, 306 overview, 302–303 WAMPServer installation kit, 24, 38 Warning icon, 3 warning messages, 311, 312 web browsers defined, 7 detecting with JavaScript, 214–216 fonts, choosing web-friendly, 138–140 general discussion, 8 JavaScript support, 188, 220 on mobile devices, 10 redirecting to other pages, 216–217 testing CSS across multiple, 122–123 Web Fonts, 135690 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies web forms. See also validation aligning fields with CSS, 180–183 blank fields, checking for, 246–247 check boxes, creating, 176–177 clearing, 180 counting characters in text boxes, 254–257 creating, 593–602 creating with OOP, 414–415 disabling form fields, 257–259 drop-down boxes, adding, 174–176 <form> tag, 172–173 general discussion, 169–170 input elements of, 170–172 malicious attacks through, 429–432 mouse click event handler, adding, 247–251 overview, 169 radio buttons, 178–179 submit event handler, adding, 242–246 submitting, 179–180 text inputs, adding, 173–174 unexpected input, handling, 429–432 web hosting choosing hosts, 14–15 for company websites, 15–16 hosted websites, using, 18–19 overview, 14 web-hosting companies, choosing, 16–18 web page languages CSS, 11 HTML, 10–11 JavaScript, 11–12 overview, 10 web pages block-level elements, 98 body section, 94 comments, 101–102 creating, 97–98 displaying PHP content on, 278–281 head section, 92–93 images, adding, 113–116 inline elements, 98 links, adding, 108–112 lists, adding, 102–105 overview, 7, 91–92 root element, 92 tables, 102–103, 105–108 title elements, 93 web server languages Apache httpd, 13–14 MySQL, 12–13 overview, 12 PHP, 12–13 web servers. See also web hosting Apache advantages of, 14 checking version of, 42 configuring, 32–33, 83–84 configuring for PHP, 47–48, 49 getting information on, 31 installing on local computers, 19–20 installing PHP on Linux or Unix with, 41 obtaining, 22–24 overview, 8, 21, 273 PHP compatability with, 273 running as service, 85 securing, 426–427 starting and stopping, 28–30 testing web servers, 21–22 verifying downloaded files, 24–25 version of, checking, 41 XAMPP Control Panel, starting and stopping with, 78–79 configuring for PHP, 47–49 defined, 7 FTP, logging in to, 379 general discussion, 8–9 HTML documents, storing on, 89–90 installing, 25–28 installing on local computers, 19–20 PHP files, processing of, 271–272 securing, 425–426 testing for, 21–22 web services accepting input, 548–553 general discussion, 541–542Index overview, 541 returning data from databases, 545–548 returning dates from, 542–545 web space, 81 web-hosting companies choosing, 16–18 overview, 15 websites Apache, obtaining software from, 23 authenticated pages, adding, 612–618 company websites, web hosting for, 15–16 confidentiality of, 587 function files, creating, 591–593 general discussion, 588 hosted, 18–19 login pages, building, 604–607 MySQL, downloading software from, 58 opening files in other, 386 overview, 587 paid access to, 587 PHP, downloading from, 37 success pages, building, 602–604 user database, creating, 589–591 User objects, creating, 607–611 web forms, creating, 593–602 Welcome page, XAMPP, 80 well-formed pages, 95 WHERE clause of SELECT query, 505, 506–508 while loops, 203, 335, 338–341 widgets, 188 width CSS property, 157 wildcards, in hostnames, 460–461 Windows, Microsoft. See also XAMPP installation kit activating MySQL support, 71 Apache, installing on, 19 backing up databases on, 469 checking for MySQL on, 56 checking for PHP installation on, 36 configuring web server for PHP, 47–48 691 controlling MySQL server, 66–67 getting Apache information on, 31 installing Apache on, 25–26 installing MySQL on, 20 installing PHP on, 20, 46 MySQL Setup Wizard, running on, 60–61 obtaining Apache for, 23 obtaining MySQL for, 58 obtaining PHP for, 37 starting and stopping Apache on, 28–29 starting MySQL on, 57 text editors, 97 troubleshooting PHP and MySQL connections, 73, 74 with-apxs=FILE option, PHP, 45 with-apxs2=FILE option, PHP, 45 with-config-filepath=DIR option, PHP, 45 with-mysql=DIR option, PHP, 45 with-mysqli=DIR option, PHP, 45 with-oci8=DIR option, PHP, 45 with-openssl=DIR option, PHP, 45 with-oracle=DIR option, PHP, 45 with-pgsql=DIR option, PHP, 45 with-servlet=DIR option, PHP, 45 Wordpad, 97 write mode, opening files in, 385 writing PHP code, 277–278 to text files, with PHP, 386–387 X XAMPP installation kit Control Panel, using, 78–79 installing, 76–78 obtaining, 75–76 overview, 24, 38, 59, 75 reinstalling, 84–85 testing, 79–82 troubleshooting, 85 uninstalling, 84–85692 PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies XAMPP web page language options, 80 testing, 80 testing phpMyAdmin utility from, 81 XML (Extensible Markup Language), 45, 541, 550–553 xor, in comparisons, 327–329 Y y date format symbol, 309 Y date format symbol, 309 yum utility, 23, 37 Z Zip files, PHP, 37, 46 zlib option, configure command, 43

Author: Steve Suehring and Janet Valade

Pages: 724

Issue By: Gyan Publication

Published: 2 years ago

Likes: 0

    Ratings (0)


Related Books