Tips on how to create a dictionary

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Tips on how to create a dictionary

Post by klevis miho »

I want to create a dictionary, a very simple one, just two languages.
Can anyone help me on that? How do i design the database? I just want to get the point.

Thank You
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Tips on how to create a dictionary

Post by jackpf »

Well..make a table with a load of words in I guess.

Although I'd personally use the pspell dictionary/extension. It's pretty cool.
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: Tips on how to create a dictionary

Post by klevis miho »

You mean a table with such columns: id, word, translation ? lol
You're right, but i thought on having multiple tables; for example one english one spanish
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: Tips on how to create a dictionary

Post by klevis miho »

PS. I wan't to make it myself, for learning purposes :)
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Tips on how to create a dictionary

Post by jackpf »

Oh right.

Well...I guess

ID (auto increment, primary key)
Word (varchar...something long?)
Translation (ditto)
Word_Definition (text)
Translation_Definition (text)

Although I have no idea how you're going to populate these tables with words...you could do it yourself...but that'd take forever.
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: Tips on how to create a dictionary

Post by klevis miho »

I don't want to use just one table, the idea is that a word has one ore more translations.

As for populating the tables i don't think it would take forever because it should be a dictionary just for IT words :)
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Tips on how to create a dictionary

Post by jackpf »

Oh right. Well in that case you'll need a reference ID or something.

Table 1:
ID (auto increment, primary key)
Ref_ID (int)
Word (varchar...something long?)

Table2:
ID (auto increment, primary key)
Ref_ID (int) (this will be the same as table 1's Ref_ID)
translation (varchar)

That way, when someone goes to your dictionary page, say "dictionary.php?refid=777", you can select from table 1 where refid is 777, and join Table2 where Table1.Ref_Id = Table2.Ref_Id.
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: Tips on how to create a dictionary

Post by jayshields »

You'll want to use a one-to-many relationship then.

So have a table with an ID and a word to translate, then have a table for translations, which could have the word ID, language, and translation.
Post Reply