PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Daniel S   Radial Search   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: How to use the file
Class: Radial Search
Retrieve for German cities in a given distance
Author: By
Last change:
Date: 12 years ago
Size: 725 bytes
 

Contents

Class file image Download
<?php

/*
 * turn on error reporting
 */
error_reporting(-1);
ini_set('display_errors', 1);


require
realpath('radialsearch/radialsearch.class.php');

// create a pdo connection
$dbh = new \PDO('mysql:host=localhost;dbname=qsnip', 'root', '');

// setup the pdo connection
$dbh->setAttribute(\PDO::ATTR_ERRMODE,\PDO::ERRMODE_EXCEPTION );
$dbh->exec('SET NAMES utf8');

/*
 * Uncomment if the required table
 * is not installed yet
 */

#require realpath('radialsearch/databasesetup.php');
#databasesetup($dbh, realpath('radialsearch/setup.sql')); exit('Setup success.');


$search = new RadialSearch($dbh);

$search->setSource('Leopoldshöhe');
$search->setRadius(2);
$result = $search->getResult();

print_r($result);


?>