N2S

Topic: Changing Dropdown City Selection when Posting Job

very simple and easy to do. Read carefully. (especially if you have a live site) which I doubt, but whatever.

here is what we want to do...
http://img512.imageshack.us/img512/9664/image3gv5.jpg

here are the basic steps..
1) login to phpbyadmin
2) backup database (just in case)
3) "drop" (delete) cities
4) execute mysql command to create new "cities".
*I am using USA cities for this tutorial.

GO TO: your phpmyadmin and login to your correct database.
if you dont know your login information, simply go to your jobber installation folder. Open "config.php" and find the following..

BACKUP DATABASE:
after logging into the correct database your site is hosted under follow these instructions. (taken from another site. they work.)

Code:
Backup of Mysql database
It is assumed that you have phpMyAdmin installed since a lot of web service providers use it.
http://fragments.turtlemeat.com/image2-mysql-database-backup-restore-phpmyadmin.php
0. Open phpMyAdmin.
1. Click Export in the Menu to get to where you can backup you MySql database. Image showing the export menu.
2. Make sure that you have selected to export your entire database, and not just one table. There should be as many tables in the export list as showing under the database name.
3. Select"SQL"-> for output format, Check "Structure" and "Add AUTO_INCREMENT" value. Check "Enclose table and field name with backquotes". Check "DATA", check use "hexadecimal for binary field". Export type set to "INSERT".
4. Check "Save as file", do not change the file name, use compression if you want. Then click "GO" to download the backup file.
Image showing step 2-4.

http://fragments.turtlemeat.com/img/mysql_backup1.gif
http://img512.imageshack.us/img512/7844/mysqlbackup2vk6.gif

DELETE (DROP):
you want to "drop" the category "cities" completely from the database. (we are going to create a whole new fresh "cities" table on the database. sounds good!)
so how do we do this? Its actually really simple and straightforward. ( I am going to use the image examples above so please take a look at them carefully)
on the left side of the screen click your database name. (example - "showbiz_glog")
you should now see a list of categories..find "cities" and delete is by clicking the red cross
http://img247.imageshack.us/img247/1466/datazz6.jpg
it should prompt you to confirm the "drop". just click yes.
ok now you have just deleted cities! great. one more simple step.

GO TO: http://www.jobberbase.com/wiki/index.php/Db_Versions
copy the cities you want to use.
(I am using United States States. the first one.)

Code:
CREATE TABLE `cities` (
  `id` int(11) NOT NULL,
  `name` varchar(50) NOT NULL,
  `ascii_name` varchar(50) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `cities` (`id`, `name`, `ascii_name`) VALUES
(-1, 'Anywhere', 'Anywhere'),
(1, 'Alabama', 'Alabama'),
(2, 'Alaska', 'Alaska'),
(3, 'Arizona', 'Arizona'),
(4, 'Arkansas', 'Arkansas'),
(5, 'California', 'California'),
(6, 'Colorado', 'Colorado'),
(7, 'Connecticut', 'Connecticut'),
(8, 'Delaware', 'Delaware'),
(9, 'Florida', 'Florida'),
(10, 'Georgia', 'Georgia'),
(11, 'Hawaii', 'Hawaii'),
(12, 'Idaho', 'Idaho'),
(13, 'Illinois', 'Illinois'),
(14, 'Indiana', 'Indiana'),
(15, 'Iowa', 'Iowa'),
(16, 'Kansas', 'Kansas'),
(17, 'Kentucky', 'Kentucky'),
(18, 'Louisiana', 'Louisiana'),
(19, 'Maine', 'Maine'),
(20, 'Maryland', 'Maryland'),
(21, 'Massachusetts', 'Massachusetts'),
(22, 'Michigan', 'Michigan'),
(23, 'Minnesota', 'Minnesota'),
(24, 'Mississippi', 'Mississippi'),
(25, 'Missouri', 'Missouri'),
(26, 'Montana', 'Montana'),
(27, 'Nebraska', 'Nebraska'),
(28, 'Nevada', 'Nevada'),
(29, 'New Hampshire', 'New Hampshire'),
(30, 'New Jersey', 'New Jersey'),
(31, 'New Mexico', 'New Mexico'),
(32, 'New York', 'New York'),
(33, 'North Carolina', 'North Carolina'),
(34, 'North Dakota', 'North Dakota'),
(35, 'Ohio', 'Ohio'),
(36, 'Oklahoma', 'Oklahoma'),
(37, 'Oregon', 'Oregon'),
(38, 'Pennsylvania', 'Pennsylvania'),
(39, 'Rhode Island', 'Rhode Island'),
(40, 'South Carolina', 'South Carolina'),
(41, 'South Dakota', 'South Dakota'),
(42, 'Tennessee', 'Tennessee'),
(43, 'Texas', 'Texas'),
(44, 'Utah', 'Utah'),
(45, 'Vermont', 'Vermont'),
(46, 'Virginia', 'Virginia'),
(47, 'Washington', 'Washington'),
(48, 'West Virginia', 'West Virginia'),
(49, 'Wisconsin', 'Wisconsin'),
(50, 'Wyoming', 'Wyoming');

ok kool.
go back to your phpmyadmin screen and click on "sql" (top left)
http://img128.imageshack.us/img128/9451/image3xg7.gif

a screen should pop up on your screen. Paste the copied text into the area and hit "go"
http://img128.imageshack.us/img128/6550/image5hm6.jpg

THATS IT! (=
go back to your jobber site and test it out by posting a new job.
http://img512.imageshack.us/img512/9664/image3gv5.jpg

post your problems here.
(search google first.)

http://i34.tinypic.com/2affofk.png

bodza

Re: Changing Dropdown City Selection when Posting Job

Great, Thanks a lot!!:-) It works fine!

If your country is not listed there, you can do the following:

CREATE TABLE `cities` (
  `id` int(11) NOT NULL,
  `name` varchar(50) NOT NULL,
  `ascii_name` varchar(50) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `cities` (`id`, `name`, `ascii_name`) VALUES
(-1, 'yourcontry', 'yourcountry'),
(1, 'cities', 'cities');
Please note that the last mark has to be a ; at the end of the list!!

fergster

Re: Changing Dropdown City Selection when Posting Job

If I want to add a few different countries to the list i.e. UK USA etc

How should the query look,cause if I run it again as per above SQL throws back errors

Thanks in advance