title: explode/implode from database php
body: <p>I'm want string out of the column data.
  But it failed.</p>
  
  <p><img src="https://i.stack.imgur.com/Ld9Wh.jpg" alt="enter image description here"></p>
  
  <pre><code>    &lt;?php
      $conn = mysql_connect("localhost", "nantawat", "12345678") or die(mysql_error());
      $select_db = mysql_select_db("my_db", $conn) or die(mysql_error());
      $select_tbl = mysql_query("SELECT * FROM log", $conn);
  
      while ($fetch = mysql_fetch_object($select_tbl)) {
          $r = $fetch-&gt;data;
  
      $i = explode(",", $r);
  
      if (!isset($i[1])) {
          for ($j = 0; $j &lt;= 200; $j++) {
              $i[$j] = null;
          }
      }
  
      $name = $i[0];
      $mama = $i[1];
  
      $no = $i[2];
      $a = $i[3];
      $b = $i[4];
  
      echo $name . "&lt;/br&gt;";
      echo $mama . $no . $a . $b . "&lt;/br&gt;";
  
  }
  
  while ($data = mysql_fetch_object($select_tbl)) {
  
      echo $data-&gt;data . "&lt;br&gt;";
  }
  
  ?&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/J6mDL.jpg" alt="enter image description here"></p>
  
  <p>But  i want output = </p>
  
  <pre><code>bus 
  car
  bike
  aabus
  car
  bike
  aabus
  car
  bike
  aabus
  
  ddd
  ee
  </code></pre>
  
  <p>And i not </p>
  
  <blockquote>
    <p>Notice: Undefined offset: 3 in C:\xampp\htdocs\logs\New folder
    (2)\explode.php on line 21</p>
    
    <p>Notice: Undefined offset: 4 in C:\xampp\htdocs\logs\New folder
    (2)\explode.php on line 22</p>
  </blockquote>
  
  <p>Thank You.</p>