PHP Classes

File: radialsearch/databasesetup.php

Recommend this page to a friend!
  Classes of Daniel S   Radial Search   radialsearch/databasesetup.php   Download  
File: radialsearch/databasesetup.php
Role: Auxiliary script
Content type: text/plain
Description: SQL setup script
Class: Radial Search
Retrieve for German cities in a given distance
Author: By
Last change: Description fix
Date: 12 years ago
Size: 798 bytes
 

Contents

Class file image Download
<?php

/**
 * Radial Search Database setup file
 *
 * @author Daniel Sentker tracid2008 at gmail dot com
 * @copyright (c) 2011 Daniel Sentker
 * @package RadialSearch
 */


function databasesetup(PDO $conn, $file) {
   
$conn->query('SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";');
   
$conn->query('CREATE TABLE IF NOT EXISTS `zip_coordinates` (
          `zc_id` int(11) NOT NULL AUTO_INCREMENT,
          `zc_loc_id` int(11) NOT NULL,
          `zc_zip` varchar(10) NOT NULL,
          `zc_location_name` varchar(255) NOT NULL,
          `zc_lat` double NOT NULL,
          `zc_lon` double NOT NULL,
          PRIMARY KEY (`zc_id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=17172;'
);

   
$query = file_get_contents($file);
   
$conn->query($query);
}

?>