www.webdeveloper.com
Results 1 to 2 of 2

Thread: Getting foreach() error

Hybrid View

  1. #1

    Getting foreach() error

    Warning: Invalid argument supplied for foreach()
    function cs_take_location()
    {
    list ($location, ) = explode(".",getenv("HTTP_HOST"));

    $locations = cs_get_locations(false);

    foreach ($locations['citynames'] as $cityname=>$city)
    {
    if ($cityname == $location)
    {
    global $xcityid;
    return $city[0];
    }
    }

    foreach ($locations['countrynames'] as $countryname=>$countryid)
    {
    if ($countryname == $location)
    {
    return -$countryid;
    }
    }
    }
    pls help me to solve this problem

  2. #2
    Join Date
    Mar 2009
    Posts
    452
    you have 2 foreach loops, which one does not work ? also try to var_dump() to see if you are putting valid values in.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles