Hi,
I am running a query and extracting data depending upon a variable, the language.
The language is passed in the $lang variable.
Then, I want to collect its contents.
Here is my script.
$hits = 20;
$sql = "SELECT $lang, cat,eng FROM multilang WHERE $lang IS NOT NULL AND cat = '$cat' AND confirm = 'n' ORDER BY cat LIMIT 20";
$result = mysql_query($sql) or die("could not FIND multilang categories.".mysql_error()."\r\n");
while($row = mysql_fetch_assoc($result)){
extract($row);
if (isset($span)){
if (len($span) > 0){
$word=$span;
}
}
if (isset($fren)){
if (len($fren) > 0){
$word=$fren;
}
}
if (isset($port)){
if (len($port) > 0){
$word=$port;
}
}
if (isset($ital)){
if (len($ital) > 0){
$word=$ital;
}
}
if (isset($turk)){
if (len($turk) > 0){
$word=$turk;
}
}
I think that there must be a better way to get the contents of the $row, but as I doın't know what the $lang will be I have just gone through the available ones.
Problem is if I add "greek" then I have to update this script.
Is there a better way to do this ?
Thanks