tags:

views:

23

answers:

2

In while loop I'm assigning value pulled from DB to the array like so:

$states[$row['state']]

PHP gives me the following notice:

Notice: Undefined index: ME in /var/www/vhosts/basementfinishing-md-de.com/httpdocs/inc/class.cityBlock.php on line 67

What I'm doing wrong here?

A: 

I don't have enough context to interpret the error message 100%, but I've been known to do something like this:

      $states = array();
      while ($row = mysql_fetch_assoc($result)) {
        array_push($states, $row['state']);
      }
jeffamaphone
+1  A: 

It means $row['state'] is 'ME' and this index is not defined for $states.

MatTheCat