How to Insert Bulk States and Sub-Categories in PHP Link Directory

The code below saved me hours. It lets you insert all the US states under a Parent category. This works with 3.2.0. Explanations of what you need to change are below.

  • If you’re inserting a sub-category, the parent-category-url needs to be the URL Title of the Parent Category. (i.e. parent is web-hosting, then it will be ‘web-hosting/alaska/’). If this is top level, then delete all instances of ‘parent-category-url/’ leaving it as ‘alaska/’.
  • Description is self-explanatory.
  • 999 will be the Parent_id. Replace yours as needed. If it’s Top level, this should be 0
  • Don’t Touch the 2! That means it’s active.
  • Last thing. VERY IMPORTANT. Did you notice I started with 3 in the first parentheses? Then it increments afterward. That’s because I had 2 categories already created in the database. If you have 5 categories already listed, you need to start from 6! If you have none, start from 1. That’s about the only tedious work you’ll need to do. Sorry….but no way around it.

The rest of the zeros should be modded by hand if you are tweaking seo on a category-by-category basis.

FYI….a free text editor like EditPad Lite does wonders for quick Find and Replace stuff like this.

Good luck. Code is below for MySQL.

INSERT INTO `PLD_CATEGORY` VALUES (3, 'Alaska','Alaska', 'alaska', 'parent-category-url/alaska/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (4, 'Arizona','Arizona', 'arizona', 'parent-category-url/arizona/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (5, 'Arkansas','Arkansas', 'arkansas', 'parent-category-url/arkansas/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (6, 'California','California', 'california', 'parent-category-url/california/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (7, 'Colorado','Colorado', 'colorado', 'parent-category-url/colorado/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (8, 'Connecticut','Connecticut', 'connecticut', 'parent-category-url/connecticut/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (9, 'Delaware','Delaware', 'delaware', 'parent-category-url/delaware/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (10, 'Florida','Florida', 'florida', 'parent-category-url/florida/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (11, 'Georgia','Georgia', 'georgia', 'parent-category-url/georgia/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (12, 'Hawaii','Hawaii', 'hawaii', 'parent-category-url/hawaii/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (13, 'Idaho','Idaho', 'idaho', 'parent-category-url/idaho/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (14, 'Illinois','Illinois', 'illinois', 'parent-category-url/illinois/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (15, 'Indiana','Indiana', 'indiana', 'parent-category-url/indiana/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (16, 'Iowa','Iowa', 'iowa', 'parent-category-url/iowa/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (17, 'Kansas','Kansas', 'kansas', 'parent-category-url/kansas/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (18, 'Kentucky','Kentucky', 'kentucky', 'parent-category-url/kentucky/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (19, 'Louisiana','Louisiana', 'louisiana', 'parent-category-url/louisiana/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (20, 'Maine','Maine', 'maine', 'parent-category-url/maine/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (21, 'Maryland','Maryland', 'maryland', 'parent-category-url/maryland/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (22, 'Massachusetts','Massachusetts', 'massachusetts', 'parent-category-url/massachusetts/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (23, 'Michigan','Michigan', 'michigan', 'parent-category-url/michigan/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (24, 'Minnesota','Minnesota', 'minnesota', 'parent-category-url/minnesota/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (25, 'Mississippi','Mississippi', 'mississippi', 'parent-category-url/mississippi/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (26, 'Missouri','Missouri', 'missouri', 'parent-category-url/missouri/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (27, 'Montana','Montana', 'montana', 'parent-category-url/montana/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (28, 'Nebraska','Nebraska', 'nebraska', 'parent-category-url/nebraska/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (29, 'Nevada','Nevada', 'nevada', 'parent-category-url/nevada/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (30, 'New Hampshire','New-Hampshire', 'new-hampshire', 'parent-category-url/new-hampshire/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (31, 'New Jersey','New-Jersey', 'new-jersey', 'parent-category-url/new-jersey/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (32, 'New Mexico','New-Mexico', 'new-mexico', 'parent-category-url/new-mexico/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (33, 'New York','New-York', 'new-york', 'parent-category-url/new-york/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (34, 'North Carolina','North-Carolina', 'north-carolina', 'parent-category-url/north-carolina/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (35, 'North Dakota','North-Dakota', 'north-dakota', 'parent-category-url/north-dakota/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (36, 'Ohio','Ohio', 'ohio', 'parent-category-url/ohio/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (37, 'Oklahoma','Oklahoma', 'oklahoma', 'parent-category-url/oklahoma/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (38, 'Oregon','Oregon', 'oregon', 'parent-category-url/oregon', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (39, 'Pennsylvania','Pennsylvania', 'pennsylvania', 'parent-category-url/pennsylvania/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (40, 'Rhode Island','Rhode-Island', 'rhode-island', 'parent-category-url/rhode-island/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (41, 'South Carolina','South-Carolina', 'south-carolina', 'parent-category-url/south-carolina/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (42, 'South Dakota','South-Dakota', 'south-dakota', 'parent-category-url/south-dakota/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (43, 'Tennessee','Tennessee', 'tennessee', 'parent-category-url/tennessee/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (44, 'Texas','Texas', 'texas', 'parent-category-url/texas/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (45, 'Utah','Utah', 'utah', 'parent-category-url/utah/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (46, 'Vermont','Vermont', 'vermont', 'parent-category-url/vermont/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (47, 'Virginia','Virginia', 'virginia', 'parent-category-url/virginia/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (48, 'Washington','Washington', 'washington', 'parent-category-url/washington/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (49, 'West Virginia','West-Virginia', 'west-virginia', 'parent-category-url/west-virginia/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (50, 'Wisconsin','Wisconsin', 'wisconsin', 'parent-category-url/wisconsin/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');
INSERT INTO `PLD_CATEGORY` VALUES (51, 'Wyoming','Wyoming', 'wyoming', 'parent-category-url/wyoming/', 'Description', 999, 2, '2007-08-28 14:47:25', 0, 0, 0, '', '');

Comments are closed.