little syntax error - need help please

Hi there,
I don’t understand what am I missing.
With this code I get a title, a language name and an icon flag
[php]if ($languages && $user[‘languages’]!=’’)
{
echo ‘;
foreach ($languages_array as $lang)
{
echo ’ ‘.$lang[‘name’].’’;
}
}[/php]

Why can I get just the icon flag with this one (different page)

[php] if ($user[‘languages’])
{
echo ‘’;
}[/php]

Any help will be very appreciate.
Thanks,
Nuno

Because $lang is specified in the foreach loop and therefor doesn’t exist in your second code.

Hi,
I tried to add a foreach in my second code but doesn’t work :-[
Then I tryed to remove the if condition but doesn’t work either :-[
I’m going craisy with this code :’(
Can you please be more specific, please?
Nuno

Can’t you just copy the first code and remove what you don’t need?

[php]
if ($languages && $user[‘languages’]!=’’) {
foreach ($languages_array as $lang) {
echo ‘’;
}
}
[/php]

Hi M@tt,
I really appreciate your help but, that doesn’t work.
It looks easy but at the end :-[
May I send you the 2 php files? I don’t want abuse of your kindness!
Regards,
Nuno

You’re missing a quote

[php]echo ';[/php]

should be…
[php]echo ‘’;[/php]

Hi mdahlke,
Thank you soo much. Now it’s working :smiley:
I really appreciate your help.
Nuno

Sponsor our Newsletter | Privacy Policy | Terms of Service