title: PHP code to echo exploded values inside textbox from database
body: <p>I have a textbox.</p>
  
  <p>Data in my table are as follow:</p>
  
  <pre><code>col1     col2
  701       500
  701       501
  701       503
  </code></pre>
  
  <p>I need to display all <code>col2</code> value in single textbox on edit button click like below:</p>
  
  <pre><code>500, 501, 502
  </code></pre>
  
  <p>Can you please help me to display all <code>col2</code> values in textbox from the database?</p>
  
  <p>Here is my code for that:</p>
  
  <pre><code>&lt;?php  
    $data = 0;
    if(isset($_GET['edit']))
    {
    $col1= $_GET['edit'];
    $data = $database-&gt;getRow("SELECT * FROM master where col1= :col1",array(':col1'=&gt;$col1));  
    }     
  ?&gt;
  </code></pre>
  
  <p>I have tried this but this shows an array inside textbox....</p>
  
  <pre><code>&lt;input type="text" name="col2"  value="&lt;?php echo explode(',', $data['col2']); ?&gt;"/&gt;
  </code></pre>