topical media & game development
#mobile-ar-7-3.txt / txt
// sample code
// misc snippets from chapter 7
<?php
/* Configure the connection to the MySQL database */
/* add your details here */
dbdata = “database_name”; /* your database name */
dbpass = “database_password”; /* the db password */
/* connect to the MySQL server. */
dbhost; dbname=dbuser,
db->setAttribute( PDO::ATTR_ERRMODE , PDO::ERRMODE_EXCEPTION );
//The following code will read the query string and put the parameters into an array named
keys.
value = array();
try {
// Retrieve parameter values using value array with
// parameter name as key.
foreach( key ) {
if ( isset(key]) )
key] = key];
else
throw new Exception(e) {
echo ‘Message: ‘ .response = array();
// Assign cooresponding values to mandatory JSON response keys.
value[“layerName”];
// Use Gethotspots() function to retrieve POIs with in the search range.
db, response[“hotspots”] ) ) {
response[“errorString”] = “No POI found. Please adjust the range.”;
}//if
else {
response[“errorString”] = “ok”;
}//else
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.