title: Undefined offset 1 PHPExcel
body: <p>I'm having an undefined offset after calling my data in my table. Somehow, I can get the first record. However, for the other records, I'm having an error notice that I'm having an undefined offset.</p>
  
  <p><strong>Data</strong></p>
  
  <p>Detail1||Response1||Status1::Detail2||Response2||Status2::Detail3||Response3||Status3::Detail4||Response4||Status4::Detail5||Response5||Status5::Detail6||Response6||Status6::Detail7||Response7||Status7::Detail8||Response8||Status8::Detail9||Response9||Status9::Detail10||Response10||Status10::</p>
  
  <p><strong>Result when running code</strong>:</p>
  
  <p>Detail1<br />
  Response1<br />
  Detail2<br />
  Response2<br />
  Detail3<br />
  Response3<br />
  Detail4<br />
  Response4<br />
  Detail5<br />
  Response5<br />
  Detail6<br />
  Response6<br />
  Detail7<br />
  Response7<br />
  Detail8<br />
  Response8<br />
  Detail9<br />
  Response9<br />
  Detail10<br />
  Response10<br /></p>
  
  <p>Notice: Undefined offset: 1 in C:\xampp\htdocs\uploadexcel\export.php on line 52</p>
  
  <p><strong>Code</strong>:</p>
  
  <pre><code>$querydata = "SELECT DESCRIPTION from sample";
  $resultdata = $conn-&gt;prepare($querydata);
  $resultdata-&gt;execute();
  
  $storeresult = $resultdata-&gt;fetchObject();
  $resultquery = $storeresult-&gt;DESCRIPTION;
  
  
  $pieces = explode("::",$resultquery);
  
  $countVal = count($pieces);
  
  $counter = 0;
  
  
  
  while($counter&lt;$countVal){
  $pieces1 = explode("||", $pieces[$counter]);
  $pieces2 = explode("||", $pieces[$counter]);
  
  
  echo $pieces1[0]."&lt;br&gt;"; // detail
  echo $pieces2[1]."&lt;br&gt;"; // response
  
  $counter++;
  $rowCount++;
  
  }
  </code></pre>
  
  <p>Can you help me with this? I'm confused on why my code is showing that error even though it executed right. </p>