I have a site where the language is set depending a users native language. The language snippets are stored in a db table with a language id attached to them.
The get language file looks like this:
if ($language == 'da_DK') {
///// DANISH /////
$result45 = mysql_query('SELECT * FROM '.$prefix.'_lang_code WHERE lang_id=1');
while ($row45 = mysql_fetch_assoc($result45)) {
$string = $row45['string'];
define("_".$row45['tagname']."","".$string."");
}
} else {
///// ENGLISH /////
$result46 = mysql_query('SELECT * FROM '.$prefix.'_lang_code WHERE lang_id=2');
while ($row46 = mysql_fetch_assoc($result46)) {
$string = $row46['string'];
define("_".$row46['tagname']."","".$string."");
}
}
And the loop looks like this:
$datelimit = date('Y-m-d', strtotime('-1 week'));
$sql99="SELECT * FROM ".$prefix."_users WHERE ga_active=0 and regdate < '$datelimit' AND new_userid > 0";
$result99 = mysql_query($sql99);
while($row99 = mysql_fetch_array($result99)){
$user = $row99['new_userid'];
$fname = $row99['fname'];
$lname = $row99['lname'];
$email = $row99['email'];
$regdate = $row99['regdate'];
$buser = $row99['by_user'];
$language = $row99['locale'];
$validatecode = $row99['validatecode'];
include ("includes/lang.php");
echo $row99['fname']. ' '.$row99['lname'].'<br>';
echo ''._LANG_TEST.'<br><br>';
}
Now the problem is that it seems it takes the first users "locale" and forces it upon all users, so if I have 3 users like this:
user1, locale=en_GB
user2, locale=da_DK
user3, locale=no_NO
all the users language in the loop is set to "en_GB"... Where do I go wrong...
Any help is apreciated. Thanks in advance :-)