I am having a hard time right now, I'm totally braindead with this problem and I literally can't figure out what to do.
So what is my problem?
Well I'm working on a simple php website that will be multilingual, my idea is to save values of text (For example, the title of the page is diferent in english, german, spanish..) in mysql database and then later using mysqlquery just echo out the values for the language the user has selected.
I'll try and explain a bit better, I have a table with the fields "Name, Language, Value" (all are text fields) and a couple of rows, 2 of which are "Introtext, EN, Welcome to ..." and "Introtext, DE, Wilkomm...". I still believe this isn't the proper way of saving this type of data but it will do for now.
My problem is trying to print the values in the page, my minds a blank, it's something so easy I believe but I can't do it lol. I just need to efficiently grab all values depending on the language the visitor has chosen, and then just simply output it in my page.
All I've come up with is
$intro = mysql_query("SELECT value FROM text WHERE (lan='$lan') AND (name='Introtext')") or die(mysql_error());
echo mysql_result($intro, 0);
Of course, this works, but I don't want to create 50 queries for 50 diferent values, I really need help with a way to do this easier, if anyone can mention any possible ways to make the query-print procedure easier, I'd really appreciate it!

New Topic/Question
Reply




MultiQuote





|