Skip to content

Instantly share code, notes, and snippets.

View jkuroiwa's full-sized avatar

Jared I. Kuroiwa jkuroiwa

View GitHub Profile
@jkuroiwa
jkuroiwa / demobuild.php
Created July 27, 2012 08:55 — forked from sirpengi/demobuild.php
Demo for Socrata API JSON import into MySQL
<?php
function hobo_escape($val){
// because there is no good way to escape a dynamic table/field name
$ret = preg_replace('/[^a-zA-Z _]+/', '', $val);
$ret = preg_replace('/\s+/', '_', $ret);
return $ret;
}
// Credentialing for MySQL server if you want the code to create table and load data automatically
@jkuroiwa
jkuroiwa / demobuild.php
Created July 27, 2012 00:37
Demo for Socrata API JSON import into MySQL
<?php
// Credentialing for MySQL server if you want the code to create table and load data automatically
$host = "localhost";
$user = "user";
$password = "password";
$base = "database";
$connection = mysql_connect($host,$user,$password) or die (mysql_error());
mysql_select_db($base,$connection);
// $id is the unique identifier for the Socrata data.