Hello
I am storing information on people in the database.
For each person I am storing his address.
The address may be translated to other languages and it may not.
If it is translated, this is indicated in the people table with a boolean:
If the address is not translated, it should be taken as is from this table. Otherwise, it should be translated first into a specific language.Code:create table `people` ( `ID` int unsigned not null, `First_name` varchar(255) not null, `Last_name` varchar(255) not null, `Address` varchar(255) not null, `Is_Address_translated` tinyint not null, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
I have a code in PHP that knows how to translate a string into a specific language.
The problem:
I need to be able to sort the people according to their address.
If a certain person has a non-translated language, the MySQL server should use the address as is when sorting the data.
If a certain person has a translated language, the MySQL sever should use the translated address when sorting the data.
My question:
Is there a way to utilize my PHP function, by telling MySQL to invoke some callback PHP function when it needs to compare addresses?
Another solution would be to store the translated addresses in the database (I am trying to avoid this solution if possible)
regards








Bookmarks