27
Jul
0

US States Snippet and SQL Dump

Here’s some US states snippets. Included are php arrays, and a MySQL states dump…

PHP Snippets:

//states and abbreviations snippets
$states = array('Alaska','Alabama','Arkansas','Arizona','California','Colorado','Connecticut','Delaware','Florida','Georgia','Hawaii','Iowa','Idaho','Illinois','Indiana','Kansas','Kentucky','Louisiana','Massachusetts','Maryland','Maine','Michigan','Minnesota','Missouri','Mississippi','Montana','North Carolina','North Dakota','Nebraska','New Hampshire','New Jersey','New Mexico','Nevada','New York','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Virginia','Vermont','Washington','Wisconsin','West Virginia','Wyoming');
 
$abbreviations = array('AK','AL','AR','AZ','CA','CO','CT','DE','FL','GA','HI','IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MI','MN','MO','MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VA','VT','WA','WI','WV','WY');
 
$states_assoc = array(
'AL'=>"Alabama",  
'AK'=>"Alaska",  
'AZ'=>"Arizona",  
'AR'=>"Arkansas",  
'CA'=>"California",  
'CO'=>"Colorado",  
'CT'=>"Connecticut",  
'DE'=>"Delaware",  
'DC'=>"District Of Columbia",  
'FL'=>"Florida",  
'GA'=>"Georgia",  
'HI'=>"Hawaii",  
'ID'=>"Idaho",  
'IL'=>"Illinois",  
'IN'=>"Indiana",  
'IA'=>"Iowa",  
'KS'=>"Kansas",  
'KY'=>"Kentucky",  
'LA'=>"Louisiana",  
'ME'=>"Maine",  
'MD'=>"Maryland",  
'MA'=>"Massachusetts",  
'MI'=>"Michigan",  
'MN'=>"Minnesota",  
'MS'=>"Mississippi",  
'MO'=>"Missouri",  
'MT'=>"Montana",
'NE'=>"Nebraska",
'NV'=>"Nevada",
'NH'=>"New Hampshire",
'NJ'=>"New Jersey",
'NM'=>"New Mexico",
'NY'=>"New York",
'NC'=>"North Carolina",
'ND'=>"North Dakota",
'OH'=>"Ohio",  
'OK'=>"Oklahoma",  
'OR'=>"Oregon",  
'PA'=>"Pennsylvania",  
'RI'=>"Rhode Island",  
'SC'=>"South Carolina",  
'SD'=>"South Dakota",
'TN'=>"Tennessee",  
'TX'=>"Texas",  
'UT'=>"Utah",  
'VT'=>"Vermont",  
'VA'=>"Virginia",  
'WA'=>"Washington",  
'WV'=>"West Virginia",  
'WI'=>"Wisconsin",  
'WY'=>"Wyoming");

MySQL Snippets:
[sql]
— —————————-
— Table structure for states
— —————————-
CREATE TABLE `states` (
`state_id` tinyint(3) unsigned NOT NULL,
`state_name` varchar(22) NOT NULL,
`state_abbreviation` char(2) NOT NULL,
PRIMARY KEY (`state_id`),
UNIQUE KEY `state_abbreviation` (`state_abbreviation`)
) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8;

— —————————-
— Records
— —————————-
INSERT INTO `states` VALUES (‘1’, ‘Alabama’, ‘AL’);
INSERT INTO `states` VALUES (‘2’, ‘Alaska’, ‘AK’);
INSERT INTO `states` VALUES (‘3’, ‘Arizona’, ‘AZ’);
INSERT INTO `states` VALUES (‘4’, ‘Arkansas’, ‘AR’);
INSERT INTO `states` VALUES (‘5’, ‘California’, ‘CA’);
INSERT INTO `states` VALUES (‘6’, ‘Colorado’, ‘CO’);
INSERT INTO `states` VALUES (‘7’, ‘Connecticut’, ‘CT’);
INSERT INTO `states` VALUES (‘8’, ‘Delaware’, ‘DE’);
INSERT INTO `states` VALUES (‘9’, ‘District of Columbia’, ‘DC’);
INSERT INTO `states` VALUES (’10’, ‘Florida’, ‘FL’);
INSERT INTO `states` VALUES (’11’, ‘Georgia’, ‘GA’);
INSERT INTO `states` VALUES (’12’, ‘Hawaii’, ‘HI’);
INSERT INTO `states` VALUES (’13’, ‘Idaho’, ‘ID’);
INSERT INTO `states` VALUES (’14’, ‘Illinois’, ‘IL’);
INSERT INTO `states` VALUES (’15’, ‘Indiana’, ‘IN’);
INSERT INTO `states` VALUES (’16’, ‘Iowa’, ‘IA’);
INSERT INTO `states` VALUES (’17’, ‘Kansas’, ‘KS’);
INSERT INTO `states` VALUES (’18’, ‘Kentucky’, ‘KY’);
INSERT INTO `states` VALUES (’19’, ‘Louisiana’, ‘LA’);
INSERT INTO `states` VALUES (’20’, ‘Maine’, ‘ME’);
INSERT INTO `states` VALUES (’21’, ‘Maryland’, ‘MD’);
INSERT INTO `states` VALUES (’22’, ‘Massachusetts’, ‘MA’);
INSERT INTO `states` VALUES (’23’, ‘Michigan’, ‘MI’);
INSERT INTO `states` VALUES (’24’, ‘Minnesota’, ‘MN’);
INSERT INTO `states` VALUES (’25’, ‘Mississippi’, ‘MS’);
INSERT INTO `states` VALUES (’26’, ‘Missouri’, ‘MO’);
INSERT INTO `states` VALUES (’27’, ‘Montana’, ‘MT’);
INSERT INTO `states` VALUES (’28’, ‘Nebraska’, ‘NE’);
INSERT INTO `states` VALUES (’29’, ‘Nevada’, ‘NV’);
INSERT INTO `states` VALUES (’30’, ‘New Hampshire’, ‘NH’);
INSERT INTO `states` VALUES (’31’, ‘New Jersey’, ‘NJ’);
INSERT INTO `states` VALUES (’32’, ‘New Mexico’, ‘NM’);
INSERT INTO `states` VALUES (’33’, ‘New York’, ‘NY’);
INSERT INTO `states` VALUES (’34’, ‘North Carolina’, ‘NC’);
INSERT INTO `states` VALUES (’35’, ‘North Dakota’, ‘ND’);
INSERT INTO `states` VALUES (’36’, ‘Ohio’, ‘OH’);
INSERT INTO `states` VALUES (’37’, ‘Oklahoma’, ‘OK’);
INSERT INTO `states` VALUES (’38’, ‘Oregon’, ‘OR’);
INSERT INTO `states` VALUES (’39’, ‘Pennsylvania’, ‘PA’);
INSERT INTO `states` VALUES (’40’, ‘Rhode Island’, ‘RI’);
INSERT INTO `states` VALUES (’41’, ‘South Carolina’, ‘SC’);
INSERT INTO `states` VALUES (’42’, ‘South Dakota’, ‘SD’);
INSERT INTO `states` VALUES (’43’, ‘Tennessee’, ‘TN’);
INSERT INTO `states` VALUES (’44’, ‘Texas’, ‘TX’);
INSERT INTO `states` VALUES (’45’, ‘Utah’, ‘UT’);
INSERT INTO `states` VALUES (’46’, ‘Vermont’, ‘VT’);
INSERT INTO `states` VALUES (’47’, ‘Virginia’, ‘VA’);
INSERT INTO `states` VALUES (’48’, ‘Washington’, ‘WA’);
INSERT INTO `states` VALUES (’49’, ‘West Virginia’, ‘WV’);
INSERT INTO `states` VALUES (’50’, ‘Wisconsin’, ‘WI’);
INSERT INTO `states` VALUES (’51’, ‘Wyoming’, ‘WY’);
[/sql]

Enjoyed reading this post?
Subscribe to the RSS feed and have all new posts delivered straight to you.
Post your comment




Copyright © 2017 SayNoToFlash, Jamie Estep, All Rights Reserved · Theme design by Themes Boutique