Welcome Guest, Not a member yet? Register   Sign In
Finding Value in Array using isset
#1

[eluser]Fielder[/eluser]
I'm having a problem getting this isset command to locate a particular value in my array. It keeps going into the IF statement. Am I missing something?

I'm getting "Undefined index: 2975" error, when I know for a fact 2975 exists in the storeArray $key and $row['store_id']. I've var_dump both $storeArray and $stores and they both show 2975.

Any ideas? Let me know if more info. is needed.

Code:
foreach ($c as $key => $val)
{
.
.
.
  $storeArray[$key] = array(
   'storename' => $store[0]['storename_name'],
   'storenum' => $store[0]['store_number'],
   'newAd_count' => $newAd_count,
   'renewAd_count' => $val - $newAd_count,
   'totAd_count' => $val,
   'spaces_count' => $spaces_count,
   'print' => $print,
   'lastqtrAd_count' => $lastqtrAd,
   'cancelled' => $val - $cancelled,
   'freeAd_count' => $freeAd,
   'revenue' => '$ '.number_format($rev, 2)
  );
}

$stores = $this->store->getStorebyZone($data['zone']);

foreach ($stores as $row)
  {
   if (!isset($storeArray[$row['store_id']]))
   {
    $storeArray[$row['store_id']] = array(
    'storename' => $row['storename_name'],
    'storenum' => $row['store_number'],
    'newAd_count' => '0',
    'renewAd_count' => '0',
    'totAd_count' => '0',
    'spaces_count' => '0',
    'print' => 'N',
    'lastqtrAd_count' => '0',
    'cancelled' => '0',
    'freeAd_count' => '0',
    'revenue' => '$ '.number_format(0, 2)
    );
   }
  }

var_dump for $storeArray
Code:
array(8) { [2975]=>  array(11) { ["storename"]=>  string(9) "Appletree" ["storenum"]=>  string(3) "736" ["newAd_count"]=>  int(4) ["renewAd_count"]=>  int(4) ["totAd_count"]=>  int(8) ["spaces_count"]=>  int(10) ["print"]=>  string(1) "Y" ["lastqtrAd_count"]=>  int(9) ["cancelled"]=>  int(1) ["freeAd_count"]=>  int(4) ["revenue"]=>  string(

var_dump for $stores
Code:
[287]=>  array(14) { ["store_id"]=>  string(4) "2975" ["storename_name"]=>  string(9) "Appletree" ["store_number"]=>  string(3) "736" ["store_address"]=>  string(11) "2000 Hwy 21" ["store_city"]=>  string(5) "Bryan" ["store_state"]=>  string(2) "TX" ["store_zip"]=>  string(5) "77803" ["store_cycle"]=>  string(1) "B" ["store_phone"]=>  string(14) "(979) 778-0134" ["store_notes"]=>  string(0) "" ["store_open"]=>  string(1) "1" ["store_alive"]=>  string(1) "1" ["store_upscode"]=>  string(11) "APT001-0736" ["zone_number"]=>  string(1) "1" }


Messages In This Thread
Finding Value in Array using isset - by El Forum - 11-07-2009, 06:14 PM
Finding Value in Array using isset - by El Forum - 11-07-2009, 06:33 PM
Finding Value in Array using isset - by El Forum - 11-07-2009, 08:03 PM
Finding Value in Array using isset - by El Forum - 11-07-2009, 09:42 PM
Finding Value in Array using isset - by El Forum - 11-07-2009, 10:00 PM
Finding Value in Array using isset - by El Forum - 11-07-2009, 11:12 PM
Finding Value in Array using isset - by El Forum - 11-07-2009, 11:29 PM
Finding Value in Array using isset - by El Forum - 11-07-2009, 11:43 PM
Finding Value in Array using isset - by El Forum - 11-08-2009, 12:40 AM
Finding Value in Array using isset - by El Forum - 11-08-2009, 10:46 AM
Finding Value in Array using isset - by El Forum - 11-08-2009, 11:41 AM
Finding Value in Array using isset - by El Forum - 11-08-2009, 11:55 AM
Finding Value in Array using isset - by El Forum - 11-08-2009, 12:04 PM
Finding Value in Array using isset - by El Forum - 11-08-2009, 12:13 PM
Finding Value in Array using isset - by El Forum - 11-08-2009, 12:18 PM
Finding Value in Array using isset - by El Forum - 11-08-2009, 06:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB