title: Pulling column values from MySQL with PHP
body: <p>I am trying to get all the values (numeric) of the column Bruel_ID from database mpctz_rsform_bruels to display them in a RSForm dropdown box. I'm using this code:</p>
  
  <pre><code>$db = JFactory::getDbo();
  $db-&gt;setQuery("SELECT Bruel_ID FROM mpctz_rsform_bruels");
  return $db-&gt;loadResult();
  </code></pre>
  
  <p>Howeve, I am only pulling the lowest value of the column. How can I get all the values?
  Thanks,</p>
  
  <p>Dani</p>
  
  <p>Edit: I have been searching and I've found this code which was supposed to work:</p>
  
  <pre><code>//&lt;code&gt;
  // Prepare the empty array
  $items = array();
  // Prepare the database connection
  $db = JFactory::getDbo();
  // Keep this if you'd like a "Please select" option, otherwise comment or remove it
  $items[] = "|Selecciona un número[c]";
  
  // Run the SQL query and store it in $results
  $db-&gt;setQuery("SELECT Bruel_ID, Bruel_ID FROM #__rsform_bruels");
  $results = $db-&gt;loadObjectList();
  
  // Now, we need to convert the results into a readable RSForm! Pro format.
  // The Items field will accept values in this format:
  // value-to-be-stored|value-to-be-shown
  // Eg. m|M-sized T-shirt
  foreach ($results as $result) {
    $value = $result-&gt;your_value;
    $label = $result-&gt;your_label;
    $items[] = $value.'|'.$label;
  }
  
  // Multiple values are separated by new lines, so we need to do this now
  $items = implode("\n", $items);
  
  // Now we need to return the value to the field
  return $items;
  //&lt;/code&gt;
  </code></pre>
  
  <p>However, it displays nothing in the dropdown box, just the default value. Any help?</p>