Last active
December 24, 2015 19:49
-
-
Save AtomicSmash/6853407 to your computer and use it in GitHub Desktop.
INCOMPLETE - So far this script grabs local authority information from openlylocal.com, then output the address and turn the postcode into an array.
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 | |
// Connects to your Database | |
set_time_limit(20000); | |
mysql_connect("localhost", "root", "root") or die(mysql_error()); | |
mysql_select_db("postcodes") or die(mysql_error()); | |
$data = mysql_query("SELECT * FROM my_table2") | |
or die(mysql_error()); | |
//Print "<table border cellpadding=3>"; | |
$words = ""; | |
$lastWords = ""; | |
while($info = mysql_fetch_array( $data )) | |
{ | |
//Print "<tr>"; | |
$words = explode(" ", $info['var1']); | |
//$firstWords = array_slice($words, 0,5); | |
$lastWords = array_slice($words, -2,2); | |
//mysql_query("INSERT INTO output2 (full, first, last) | |
//VALUES ('".$info['var1']."', '".$lastWords[0]."','".$lastWords[1]."')"); | |
//Print "<th>Postcode:</th> <td>".$info['var1'] . "</td> "; | |
} | |
//Print "</table>"; | |
echo "done"; | |
?> | |
GET uniques | |
SELECT * | |
FROM output2 | |
GROUP BY first | |
HAVING COUNT(DISTINCT first) = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment