[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Multi language problems with DB

Posted on 2002-05-01
3
Medium Priority
?
292 Views
Last Modified: 2006-11-17
Hello

To show my query data in a table i use the following code:

$myarray=array("NAME","STREET","POSTAL") and so on...

$result=("select * from my table");
while($row=mysql_fetch_array($result)) {
  reset($myarray);
  echo "<table>";
  while (current($myarray)) {
     echo "<tr><td>".current($myarray)."</td>";
     echo "<td>".$row[current($myarray)]."</td></tr>";
  }
  echo"</table>";
}

Now i want to make my page multi language and i want the description of each field in the selected language.

I try to do something like that:

the vars l_name ... comes from the selected language file

$myarray=array("NAME" => $l_name, "STREET" => $l_street, "POSTAL" => $l_postal);

$result=("select * from my table");
while($row=mysql_fetch_array($result)) {
  reset($myarray);
  echo "<table>";
  while (list($key,$value)=each(current($myarray)) {
     echo "<tr><td>".current($key)."</td>";
     echo "<td>".$row[current($value)]."</td></tr>";
  }
  echo"</table>";
}
 
This does not work.
Any idee how to do this???

Thanks,
seever

0
Comment
Question by:Seever
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Expert Comment

by:us111
ID: 6985545
what's your fields name in different language ??
NAME_FR......
0
 
LVL 1

Accepted Solution

by:
teuy earned 200 total points
ID: 6985560
// Key of $myarray is a name of table field and value of $myarray is a display message, right?
$myarray=array("NAME" => $l_name, "STREET" => $l_street, "POSTAL" => $l_postal);

$result=("select * from my table");
while($row=mysql_fetch_array($result)) {

     print "<table>";
          foreach( $myarray as $FieldName => $DisplayFieldName )
               print "<tr><td>$DisplayFieldName</td><td>".
             $row[$FieldName]."</td></tr>";
     print "</table>";
} //EndWhile Getting eachrow

0
 
LVL 1

Author Comment

by:Seever
ID: 6985586
l_name, l_street ...
I use different laguage files but the variables are the same.

I call my language files with

$lang = "language/language_".$language.".inc";
require($lang);

my fieldnames in my DB are caling NAME, STREET, ....
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question