Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
adding a relation to a region:
Old 02-12-2009, 06:05 PM adding a relation to a region:
PWS
Novice Talker

Posts: 14
Name: R Pearson
Trades: 0
Hi all
Below is what I have carried out and the output is fine, all in the correct order like English Counties, Welsh Counties etc.. however in the dropdown box it is all strung together. I wish to include into the dropdown box the following in bold to divide it up a little:

English Counties
Abbots Langley
Aberaeron
Aberdare

Welsh Counties
Abbots Langley
Aberaeron
Aberdare

The below is what I am working with.

Code:
  
-- Table structure for table `pmr_locations`
--
 
CREATE TABLE IF NOT EXISTS `pmr_locations` (
`name` varchar(50) DEFAULT NULL,
`name2` varchar(50) DEFAULT NULL,
`name3` varchar(50) DEFAULT NULL,
`name4` varchar(50) DEFAULT NULL,
`name5` varchar(50) DEFAULT NULL,
`name6` varchar(50) DEFAULT NULL,
`id` int(5) UNSIGNED NOT NULL AUTO_INCREMENT,
`regionId` int NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1503 ;
 
CREATE TABLE IF NOT EXISTS region(
regionId int NOT NULL,
descr varchar(255) NOT NULL,
PRIMARY KEY (regionId)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
INSERT INTO region(regionId, descr) VALUES (1,'Wales');
INSERT INTO region(regionId, descr) VALUES (2,'England');
INSERT INTO region(regionId, descr) VALUES (3,'Scotland');
 
INSERT INTO `pmr_locations` (`name`, `name2`, `name3`, `name4`, `name5`, `name6`, `id`, regionId) VALUES
('Abbots Langley', NULL, NULL, NULL, NULL, NULL, 1, NULL),
('Aberaeron', NULL, NULL, NULL, NULL, NULL, 2, NULL),
('Aberdare', NULL, NULL, NULL, NULL, NULL, 3, NULL),
('Aberdeen', NULL, NULL, NULL, NULL, NULL, 4, NULL),
('Aberdovey', NULL, NULL, NULL, NULL, NULL, 5, NULL),
('Aberfeldy', NULL, NULL, NULL, NULL, NULL, 6, NULL),
('Abergavenny', NULL, NULL, NULL, NULL, NULL, 7, NULL),
('Abergele', NULL, NULL, NULL, NULL, NULL, 8, NULL),
('Aberlour', NULL, NULL, NULL, NULL, NULL, 9, NULL),
('Abertillery', NULL, NULL, NULL, NULL, NULL, 10, NULL),
('Aberystwyth', NULL, NULL, NULL, NULL, NULL, 11, NULL),
--THIS AREA IS IN WALES (this is and example and not included)
('Abingdon', NULL, NULL, NULL, NULL, NULL, 12, 1),
('Aboyne', NULL, NULL, NULL, NULL, NULL, 13, 1),
('Accrington', NULL, NULL, NULL, NULL, NULL, 14, 1),
('Acharacle', NULL, NULL, NULL, NULL, NULL, 15, 1),
('Achnasheen', NULL, NULL, NULL, NULL, NULL, 16, 1),
('Addlestone', NULL, NULL, NULL, NULL, NULL, 17, 1),
('Airdrie', NULL, NULL, NULL, NULL, NULL, 18, 1),
--THIS AREA IS IN ENGLAND (this is and example and not included)
('Alcester', NULL, NULL, NULL, NULL, NULL, 19, 2),
('Aldeburgh', NULL, NULL, NULL, NULL, NULL, 20, 2),
('Alderley Edge', NULL, NULL, NULL, NULL, NULL, 21, 2),
('Aldershot', NULL, NULL, NULL, NULL, NULL, 22, 2),
('Alexandria', NULL, NULL, NULL, NULL, NULL, 23, 2),
('Alford', NULL, NULL, NULL, NULL, NULL, 24, 2),
('Alford', NULL, NULL, NULL, NULL, NULL, 25, 2),
--THIS AREA IS IN SCOTLAND (this is and example and not included)
('Alfreton', NULL, NULL, NULL, NULL, NULL, 26, 3),
('Alloa', NULL, NULL, NULL, NULL, NULL, 27, 3),
('Alness', NULL, NULL, NULL, NULL, NULL, 28, 3),
('Alnwick', NULL, NULL, NULL, NULL, NULL, 29, 3),
('Alresford', NULL, NULL, NULL, NULL, NULL, 30, 3),
('Alston', NULL, NULL, NULL, NULL, NULL, 31, 3),
('Alton', NULL, NULL, NULL, NULL, NULL, 32, 3),
('Altrincham', NULL, NULL, NULL, NULL, NULL, 33, 3),
('Alva', NULL, NULL, NULL, NULL, NULL, 34, 3),
('Ambleside', NULL, NULL, NULL, NULL, NULL, 35, 3),
('Ambleside', NULL, NULL, NULL, NULL, NULL, 36, 3),
('Amersham', NULL, NULL, NULL, NULL, NULL, 37, 3),
('Amlwch', NULL, NULL, NULL, NULL, NULL, 38, 3),
('Ammanford', NULL, NULL, NULL, NULL, NULL, 39, 3),
('Andover', NULL, NULL, NULL, NULL, NULL, 40, 3),
('Annan', NULL, NULL, NULL, NULL, NULL, 41, 3),
('Anstruther', NULL, NULL, NULL, NULL, NULL, 42, 3),
('Antrim', NULL, NULL, NULL, NULL, NULL, 43, 3),
('Appin', NULL, NULL, NULL, NULL, NULL, 44, 3),
('Appleby-in-Westmorland', NULL, NULL, NULL, NULL, NULL, 45, 3),
('Arbroath', NULL, NULL, NULL, NULL, NULL, 46, 3),
('Ardgay', NULL, NULL, NULL, NULL, NULL, 47, 3),
('Ardrossan', NULL, NULL, NULL, NULL, NULL, 48, 3),
('Arisaig', NULL, NULL, NULL, NULL, NULL, 49, 3),
('Arlesey', NULL, NULL, NULL, NULL, NULL, 50, 3),
('Armagh', NULL, NULL, NULL, NULL, NULL, 51, 3),
PWS is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to adding a relation to a region:
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.08452 seconds with 12 queries