title: How to properly fetch results into an arrays and pass to curl in php
body: <p>In table content I have three data that I want to fetch and pass into array so that I finally can pass it to curl.</p>
  
  <p>Here is the code I use to get the result from databases and its working fine</p>
  
  <pre><code>include('pdo_db.php');
  $result = $db-&gt;prepare('select * from content');
  $result-&gt;execute(array());
  while ($row = $result-&gt;fetch()) {           
      $cda=htmlentities($row['cda'], ENT_QUOTES, "UTF-8");
  }
  </code></pre>
  
  <p><strong>My question</strong> is how do I pass the three results <code>($cda)</code> into the arrays as per this line of code</p>
  
  <pre><code>$params = ["&lt;first_result&gt;","&lt;second_result&gt;","&lt;third_result&gt;"]; 
  </code></pre>
  
  <p>Here is the curl request am trying to implement based on my requirements</p>
  
  <pre><code>$params = ["&lt;first_result&gt;","&lt;second_result&gt;","&lt;third_result&gt;"]; 
  
  $ch = curl_init( "myapi/url");
  $headers = array(                                                                          
  'Content-Type: application/json',                                                                           
    "Authorization: " . $mycredentials)                                                                       
  );  
  
  curl_setopt($ch, CURLOPT_POSTFIELDS, $params); 
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $output = curl_exec($ch);
  curl_close ($ch);
  print $output;
  </code></pre>