title: How can i retrieve all the records from a table in SugarCRM?
body: <p>I am using Sugar Pro 6.1 and want to know that how can i retrieve all the products with their ids from the products table. I am trying with the following code </p>
  
  <pre><code>$sql = "SELECT id, name FROM products order by name"; 
  $result = $GLOBALS["db"]-&gt;query($sql);
  $products = $GLOBALS["db"]-&gt;fetchByAssoc($result);
  </code></pre>
  
  <p>but it always returns only the first record. </p>
  
  <p>Is it possible to grab all the products with their ids to display them in a html  dropdown, i want to display that drop down in a javascript file thats why i am using the ajax call and in a seperate php file i am using the above code that returns the ouput to the ajax call.</p>
  
  <p>Any help will be appreciated!</p>