Order <?php echo $id; ?>
</div>

  <h2>#bitcoin-otc order id <?php echo $id; ?></h2>

<?php
     	try { $db = new PDO('sqlite:./otc/OTCOrderBook.db'); }
	catch (PDOException $e) { die($e->getMessage()); }
?>
  <table class="datadisplay">
<?php
  if (!$query = $db->Query('SELECT id, created_at, refreshed_at, buysell, nick, host, amount, thing, price, otherthing, notes FROM orders WHERE id=' . $id ))
    echo "   <tr><td>No matching orders found</td></tr>\n";
  else {
    if( $entry = $query->fetch(PDO::FETCH_BOTH)){
      $entry["indexedprice"] = index_prices($entry["price"]);
?>
   <tr>
    <th>id</th>
    <td><?php echo $entry["id"]; ?></td>
   </tr>
   <tr>
    <th>created at</th>
    <td><?php echo gmdate("Y-m-d H:i:s", $entry["created_at"]); ?></td>
   </tr>
   <tr>
    <th>refreshed at</th>
    <td><?php echo gmdate("Y-m-d H:i:s", $entry["refreshed_at"]); ?></td>
   </tr>
   <tr>
    <th>type</th>
  $sth->execute();
  if (!$sth)
    echo "   <tr><td>No outstanding orders found</td></tr>\n";
  else {
    $color = 0;
    while ($entry = $sth->fetch(PDO::FETCH_BOTH)) {
      if ($color++ % 2) $class="even"; else $class="odd";
?>
   <tr class="<?php echo $class; ?>"> 
    <td><a href="vieworder.php?id=<?php echo $entry["id"]; ?>"><?php echo $entry["id"]; ?></a></td>
    <td class="type"><?php echo $entry["buysell"]; ?></td>
    <td><a href="viewratingdetail.php?nick=<?php echo htmlspecialchars($entry['nick']); ?>"><?php echo htmlspecialchars($entry["nick"]); ?></a></td>
    <td><?php echo $entry["amount"]; ?></td>
    <td class="currency"><?php echo htmlspecialchars($entry["thing"]); ?></td>
    <td class="price"><?php $indp = index_prices($entry["price"]); if (is_numeric($indp)) {printf("%.5g", $indp);} else {echo $indp; } ?></td>
    <td class="currency"><?php echo htmlspecialchars($entry["otherthing"]); ?></td>
    <td><?php echo htmlspecialchars($entry["notes"]); ?></td>
   </tr>
<?
     }
   }
?>  </table>

<?php
 include("footer.php");
?>

</body>
</html>