So, I want my website to be multilingual. However, I used to do it with a txt.php file which had all the sentences defined. I want to transfer this to my database so that I can build a rather simple CMS kind of thingy. I entered all the translations into the database and then wanted to select them and define them, like below. This is not working however. What am I doing wrong?
$sql = "SELECT * FROM Main";
$result = mysql_query($sql);
function defineStrings() { 
    switch($_SESSION[lang]) { 
        case "en": 
            while($row = mysql_fetch_assoc($result)) {
                define("$row['identifier']","$row['texten']");
            }
        break;
    } 
} 
This is called in the index.php file, like this:
if ($_SESSION[lang] == "") { 
    $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
    $_SESSION[lang] = $lang; 
    $currLang = $lang; 
} else { 
    $currLang = $_SESSION[lang]; 
    $_SESSION[lang] = $currLang; 
} 
include("Localization/lang.php"); 
include("Localization/txt.php");    
defineStrings();
 
     
    