title: Trying to Find the Best way to pull DB item in Joomla 2.5 Component
body: <p>I have a database which has 2 columns <code>id</code> and <code>title.</code>  What is the best way for me to filter through these table values to display the matching <code>title</code> results when a user submits the <code>id</code> value in a form for a Joomla 2.5 component (admin view)?  </p>
  
  <p>When I look at the documentation here:</p>
  
  <p><code>http://docs.joomla.org/Selecting_data_using_JDatabase</code></p>
  
  <p>I see that by using Joomla’s API I can use a shorthand to create this connection.  I have tried:</p>
  
  <pre><code>$userSubmittedIDValue = $_GET["userSubmittedIDValue"];
  
  // Get a db connection.
  $db = JFactory::getDbo();
  
  // Create a new query object.
  $query = $db-&gt;getQuery(true);
  
  $query
  -&gt;select($db-&gt;quoteName(array('title')))
  -&gt;from($db-&gt;quoteName('#__mycomponent_table'))
  -&gt;where($db-&gt;quoteName('id') . ' = '. $db-&gt;quote('$userSubmittedIDValue'))
  
  $results = $db-&gt;loadObjectList();
  </code></pre>
  
  <p>Unfortunately, this gives the following error:</p>
  
  <p><code>Parse error: syntax error, unexpected T_VARIABLE</code></p>
  
  <p>Then the error points to <code>$results = $db-&gt;loadObjectList();</code> </p>
  
  <p>I just need to pull that value and apply it to a php variable so that I can use it as required.  Any ideas?</p>
  
  <hr>
  
  <p>Okay thanks to the first answer I have realized that I was missing a semi-colon.  The trouble I am having now is still in pulling the value from the array using <code>foreach</code>.  I have tried adding the following:</p>
  
  <pre><code>foreach (array($results) as $userSubmittedIDValue) {
  
  echo $results;
  
  }
  </code></pre>
  
  <p>But this just prints the word <code>Array</code>.  I am getting close, but something is still off.</p>