hi everyone..!
i am working on a web site which is in two languages.. so i need a help
i am inserting values in database and i need to retrive it and showing in another language which i use
thanks in advance
hi everyone..!
i am working on a web site which is in two languages.. so i need a help
i am inserting values in database and i need to retrive it and showing in another language which i use
thanks in advance
Many solutions to that. Basically you have to have two columns for each value in different languages. The field names can have language in their names (such as comment_en, comment_fr for english and french languages). The language is stored somewhere (like in a cookie, in a session or as user preference). So if using a session variable you would select a comment in selected language like this:
if(isset($_SESSION['lang'])) {
// read the language abbreviation if set
$lang = $_SESSION['lang'];
} else {
// otherwise set to default (english)
$lang = 'en';
}
$query = "SELECT comment_$lang FROM comments";
If you would like to provide interactive change of language, you can put language in querystring (or use ajax in specific cases).
ho great dear its nice
Has this solved your problem? If yes, please mark the question as solved. Happy coding.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.