Jump to content

[SOLVED] Multilingual website


joesaddigh

Recommended Posts

I am trying to offer a language translation on my site. I am trying to implement this dynamically from a language table.

 

I have encoded the database to utf 8 and the arabic characters are being displayed in the database but when i get them from the databse and echo them to the screen it just displays question marks. Is there something i need to do in order to get the browser to display the arabic characters....

 

The code that gets the text is as follows:

 

elseif (isset($_GET['language']))
			{				
				$language = $_GET['language']; 
				echo $language;
				//Get the selected language text from the database
				require "connectstudent.php";
				$query = "select * from language where language = ''";
				$result = mysql_query($query, $conn)
					or die ("Unable to get selected language".mysql_error());

				//Get the languageID
				$querylanguageid="SELECT LanguageID FROM language WHERE Language = '$language'";
				$resultlanguageid=mysql_query($querylanguageid) or die("error getting languageid");
				$rowlanguageid = mysql_fetch_assoc($resultlanguageid);
				$languageid=$rowlanguageid['LanguageID'];
				echo $languageid;

				$querylanguage= "SELECT language.LanguageID, language.Language, languagepage.LanguageID, languagepage.PageID, languagepage.Section, languagepage.Text
				FROM language
				INNER JOIN languagepage
				ON language.LanguageID = languagepage.LanguageID
				WHERE languagepage.LanguageID = '$languageid'
				AND languagepage.PageID = 1
				AND languagepage.Section = 'rightcolumn'";
				$resultlanguage = mysql_query($querylanguage, $conn)
					or die ("The join query is not working");

				while($row= mysql_fetch_array($resultlanguage))
				{

					//HTTP_ACCEPT_LANGUAGE Experiment to see if this is needed get parse error when using this
					//$languagetext =$HTTP_ACCEPT_LANGUAGE $row['Text'];	
					$languagetext = $row['Text'];
					echo $languagetext;
				}

 

If anybody has any knowledge of this problem i would be really grateful for some advice

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/149693-solved-multilingual-website/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.