Page 1 of 1

Tips on how to create a dictionary

Posted: Sun Aug 23, 2009 6:49 am
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

Re: Tips on how to create a dictionary

Posted: Sun Aug 23, 2009 7:06 am
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.

Re: Tips on how to create a dictionary

Posted: Sun Aug 23, 2009 7:15 am
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

Re: Tips on how to create a dictionary

Posted: Sun Aug 23, 2009 7:17 am
by klevis miho
PS. I wan't to make it myself, for learning purposes :)

Re: Tips on how to create a dictionary

Posted: Sun Aug 23, 2009 7:56 am
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.

Re: Tips on how to create a dictionary

Posted: Sun Aug 23, 2009 8:03 am
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 :)

Re: Tips on how to create a dictionary

Posted: Sun Aug 23, 2009 9:24 am
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.

Re: Tips on how to create a dictionary

Posted: Sun Aug 23, 2009 9:25 am
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.