|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Hello,
my database table has a column "Colour". There you can find different linguistic versions (english, french, german) of the same colour. Example: red (german: rot; french: rouge) How do I have to write my query string in MYSQL/PHP in order to get the three versions when asking for "red"? I have tried the following: ----------------------------------------- if ($colour == "") {$colour = '%';} if ($colour == "red") {$colour2 = "rot";} if ($colour == "red") {$colour3 = "rouge";} $sql = "select * from table where (colour like '$colour' or colour like '$colour2' or colour like '$colour3')"; ------------------------------------------- I always get the answer " No data found..", but there is some data that should be found. Please, tell me how to modify this coding to get it run correctly. Thank you Niko |
|
#2
|
|||
|
|||
|
You can make two tables: colours and languages. In the first you put all the colornames for each color and language. In the second you define the languages.
Table Colors colorID/LangID/ColorName (Primary ColorID, LangID) 1 1 Red 1 2 Rood 1 3 Rot 1 4 Rouge 2 1 Blue 2 2 Blauw etc. Table Languages LangID/Language (Primary: LangID) 1 English 2 Dutch 3 German 4 French etc. Now to get all the language names for Red (colorID=1): select ColorName from Colors where ColorID=1; Or you make one table with different language fields, and a row for each color: ColorID/EnglishName/DutchName etc. 1 Red Rood ... Then select the row you want: Select * from tablename where ColorID=1 (or where EnglishName='Red'); Just try what suits your needs best. Peter |
|
#3
|
|||
|
|||
|
Hi Peter,
Thank you so much for your help! Regards NiKo |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > MYSQL & PHP Query variables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|