title: How to populate a dropdown list from the database table in SugarCRM Community 6.5?
body: <p>I've asked this question in the SugarCRM forums, but have been unable to find the answer as well. I am trying to populate a dropdown list in SugarCRM Community 6.5. I am using PHP5, MySQL and Apache. I created a custom dropdown list named 'oz_accounts' in the dropdown editor, created a new field in the custom module, Machines, that I built and associated the field with the Edit, Quick Create, Detail and List views based on the dropdown menu. Here is the code that I used, the result is a blank dropdown menu:</p>
  
  <pre><code>    &lt;?php
      require_once('include/entryPoint.php');
      $db = &amp; DBManagerFactory::getInstance();
      $myQuery = "SELECT name FROM accounts";
      $Result = $db-&gt;query($myQuery);
      $new_array = array();
      while($row = $db-&gt;fetchByAssoc($Result)) {
           $new_array[$row['key']] = $row['value'];
      }
      $GLOBALS['app_list_strings']['oz_accounts'] = $new_array;
  </code></pre>
  
  <p>Could someone please advise on what I'm doing incorrectly? I tested the query in phpmyadmin, and it retrieves the result i'm looking for, so I'm assuming that I must be making a mistake somewhere in the PHP code, possibly connecting to the database.</p>