Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $query = tep_db_query("SELECT countries_name, countries_id FROM " . TABLE_COUNTRIES);
- $countries = array();
- while($row = tep_db_fetch_array($query))
- {
- $countries[$row['countries_id']] = $row['countries_name'];
- }
- ///////////////////////////////////////////////////////////////////////////////////
- $country_name = "Africa";
- $country_id = NULL;
- foreach($countries as $id => $name)
- {
- if($country_name == $name)
- {
- $country_id = $id;
- break;
- }
- }
- if($country_id != NULL)
- {
- echo $country_name . ' has an ID of ' . $country_id;
- {
- else
- {
- echo 'Could not find an ID of ' . $country_name . ' because it does not exist';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement