Jump to content

[SOLVED] Array


Daney11

Recommended Posts

Hey guys,

 

I have an array

<?php

$location = array(
'af' => 'Afghanistan',
'al' => 'Albania',
'dz' => 'Algeria',
'as' => 'American Samoa',
'ad' => 'Andorra',
'ao' => 'Angola',
'ai' => 'Anguilla',
'aq' => 'Antarctica',
'ag' => 'Antigua And Barbuda',
'ar' => 'Argentina',
'am' => 'Armenia',
'aw' => 'Aruba',
'au' => 'Australia');

?>
etc

 

And i have a mysql row called $member_nation.

 

Im using

 

<?php 

foreach ($location as $member_nation) { 
echo $member_nation;
}
?>

But it is not getting the information from the array. Any ideas?

Thanks

Link to comment
Share on other sites

My code works fine. What code would you like to see.

 

If i echo $member_nation it works fine.

 

For example it will echo "en".

 

<?php

$location = array(
'af' => 'Afghanistan',
'al' => 'Albania',
'dz' => 'Algeria',
'as' => 'American Samoa',
'ad' => 'Andorra',
'ao' => 'Angola',
'ai' => 'Anguilla',
'aq' => 'Antarctica',
'ag' => 'Antigua And Barbuda',
'ar' => 'Argentina',
'am' => 'Armenia',
'aw' => 'Aruba',
'au' => 'Australia');
'en' => 'England');

?>

Link to comment
Share on other sites

that echos out every single value within my array.

 

<?php

$location = array(
'af' => 'Afghanistan',
'al' => 'Albania',
'dz' => 'Algeria',
'as' => 'American Samoa',
'ad' => 'Andorra',
'ao' => 'Angola',
'ai' => 'Anguilla',
'aq' => 'Antarctica',
'ag' => 'Antigua And Barbuda',
'ar' => 'Argentina',
'am' => 'Armenia',
'aw' => 'Aruba',
'au' => 'Australia',
'at' => 'Austria',
'aw' => 'Aruba',
'ax' => 'Aland Islands',
'az' => 'Azerbaijan',
'bs' => 'Bahamas',
'bh' => 'Bahrain',
'bd' => 'Bangladesh',
'bb' => 'Barbados',
'by' => 'Belarus',
'be' => 'Belgium',
'bz' => 'Belize',
'bj' => 'Benin',
'bm' => 'Bermuda',
'bt' => 'Bhutan',

and so on

 

I need it to echo out a specific value with is the $member_nation

Link to comment
Share on other sites

Basically.

 

I have an array full of countrys

 

en = england

'by' => 'Belarus',

'be' => 'Belgium',

'bz' => 'Belize',

 

etc.

 

I have a $member_nation in the database which contains the 2 letter from countrys i.e. en

 

I would like to echo out the member_nation as the country name i.e. England

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.