/    Sign up×
Community /Pin to ProfileBookmark

Noob alert, db problem!

Hello,

I have just finished my MySQL db and started programming the php part. I soon came to realize that I might be doing something really really wrong!

This is how it works:

In my mysql i got several fields one is called City VARCHAR(20) and lies in the table Users.

Now, on my site i have a DropDownListBox with allot of cities in it. BUT here comes the big BUT. Lets say that one day, i need to change the name of a city (for some stupid reason). What happens then to all the users that are already registered? They will keep the old name of the city unless i change that manually one by one… thousands…. no thanks…

So, since im a mysql noob im guessing that i need to add all the cities to my mysql db and then link the User to the current city using a KEY…?? Cities would then have to be placed in a new table followed by a lot of things, I don’t know this part… please help!

If thats the case can you give me an code example please? Any help would be appreciated!

(if you think cities sound stupid, well its just an example ? im not using cities in the real app. I just started out writing it wrong here)

BIG thanks to you all!

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @deep spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...