How to show only one row of field

Im pretty inexperienced with php and MySQL and have ran into a problem which i hope you can help me with,

i have a select box populated with data from Mysql, heres a look at the code

$query = "SELECT id,output, tempname FROM templates ORDER BY output";
  $result = mysql_query($query);
  
  while ($row = mysql_fetch_array($result))
  {
      $value = $row["id"];
      $output = $row["output"];
      $tempname = $row["tempname"];
      $pairs["$value"] = $tempname;
  }
  
  echo create_dropdown("create_output", $pairs, "Choose Your Template");


  function
  create_dropdown($identifier,$pairs,$firstentry)
     {
         // start dropdown list with the <select> element and title
         $dropdown = "<select name=\\"$identifier\\" method=\\"post\\" onchange=\\"showtemplate(this.value)\\">";
         $dropdown .= "<option name=\\"\\">$firstentry</option>";
         
         // Create the elements for inside the drop down box
         foreach($pairs AS $value => $tempname)
         {
             $dropdown .="<option name=\\"$value\\">$tempname</option>";
         }
         
         //end the dropdown function and return it as html
         echo "</select>";
         return $dropdown;
     }

using ajax i then select from the dropdown and it populates a textarea with the relevant field (name of field is output) contents from the row, anyway it populates the textarea fine but the problem is it is pulling in all rows from the column instead of just the selected row,

heres the code that populates the textarea upon ajax passing the info over

$query = "SELECT output FROM templates"; 
     
$result = mysql_query($query);
while ($row = mysql_fetch_object($result))
{
 print $row->output;
}

can any of you guys see where i am going wrong, over 2 days trying to get this thing going…thanks

SELECT output FROM templates WHERE column = ‘value’

thanks for the quick reply, now it is just returning errors into the textarea after adding the WHERE column = ‘value’

<br />
<b>Warning</b>:  mysql_fetch_object(): supplied argument is not a valid MySQL result resource in <b>C:\\wamp\\www\\simply\\include\\get_template.php</b> on line <b>12</b><br />
Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'column='value'' at line 1 Actual query: SELECT output FROM templates WHERE column='value'

i really am stuck with this one, i have tried no end of permutations to deliver just the mysql column content from just one row

Column is a reserved word if I’m not mistaken, you therefore need to quote it with [URL=“http://dev.mysql.com/doc/refman/5.0/en/identifiers.html”]backticks.

or better replace this example name with real column name
as well as real value too