Created
August 20, 2012 15:14
-
-
Save wboykinm/3405063 to your computer and use it in GitHub Desktop.
Passing geometry from client to DB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$username = //[user]; | |
$password = //[wouldntyouliketoknow]; | |
$hostname = "localhost"; | |
$database = "geosproc_btvwards"; | |
$dbh=mysql_connect($hostname, $username, $password) or die ('I cannot connect to the database because: ' . mysql_error()); | |
mysql_select_db ($database); | |
// OBQtypeQ:QFeatureQCOQgeometryQ:OBQtypeQ is my dumb version of {"type":"Feature","geometry":{"type" | |
// i.e., what the json string should start with | |
if ( strpos( $_POST['hoods'], 'OBQtypeQ:QFeatureQCOQgeometryQ:OBQtypeQ' ) == 0 ){ | |
$data = mysql_query("INSERT INTO hoods9 (json) VALUES ('".$_POST['hoods']."')"); | |
} | |
if (!$data) { | |
echo "Error"; | |
} else { | |
echo "Sweet"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment