Вот полный пример:
myPHP.php
<?php
$db = pg_connect('host=localhost dbname=contacts user=contacts password=firstphp');
$query = "SELECT * FROM friends";
$result = pg_query($query);
if (!$result) {
echo "Problem with query " . $query . "<br/>";
echo pg_last_error();
exit();
}
$list_data = null;
while($myrow = pg_fetch_assoc($result)) {
$list_data .= "<option value=\"".$myrow['id']."\">".$myrow['name']."</option>";
}
// assign it to some var, I dont know what king of template you are using
$t->assign('LIST_DATA',$list_data);
?>
myFile.tpl
<select name="one">
{LIST_DATA}
</select>