27.10.2015 Views

AJAX and PHP

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Server-Side Techniques with <strong>PHP</strong> <strong>and</strong> MySQL<br />

$result->close();<br />

// close the database connection<br />

$mysqli->close();<br />

?><br />

<br />

<br />

7. Test your script by loading<br />

http://localhost/ajax/foundations/mysql/index.php with a web browser.<br />

Figure 3.20: These User Names are Read from the Database<br />

What Just Happened?<br />

First of all, note that there is no <strong>AJAX</strong> going on here; the example is demonstrating plain <strong>PHP</strong><br />

data access functionality. All the interesting things happen in index.php. The real functionality<br />

starts by loading the error h<strong>and</strong>ler, <strong>and</strong> the configuration scripts:<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!