title: PHP echo array value after while loop
body: <p>How can I echo out value after the while loop. If I do the echo in below code its says Undefined index. </p>
  
  <pre><code>$sql_cast = "SELECT *
              FROM
                title_cast
                INNER JOIN title ON (title_cast.id_title = title.id)
                INNER JOIN `cast` ON (title_cast.id_cast = `cast`.id)
              WHERE
                title_cast.id_title = '1'";
  $result_cast = mysql_query($sql_cast) or die('log error with' .mysql_error());
  $cast = array();
  while ($row = mysql_fetch_assoc($result_cast)) {
                  $id = $row['id'];
                  $name = $row['name'];
                  $img = $row['photo_localurl'];
                  $poster = str_replace("./", "lib/", $img);
  
                  $cast[] = array('id' =&gt; $id, 'name' =&gt; $name, 'img' =&gt; $poster);
                  //$cast[] = $row;
                  }
                  //var_dump($cast);
                  echo $cast['id'] . " " . $cast['name'] . " " . $cast['poster']."&lt;br /&gt;";
  </code></pre>