<?php
# this include grabs 1 company from the database and displays it

# here we set up the fields we want to grab
$fields		= 'company_id, company_name, address1, address2, city, state_id, zip';
$fields		.= ', contact_name, contact_title, contact_email, url';
$fields		.= ', phone_area, phone_exchange, phone_digits, phone_extension';
$fields		.= ', fax_area, fax_exchange, fax_digits, fax_extension';

# basic form of grabbing rows from a DB
# ok, this is really dumb... I can't leave off the while-loop and echo just 1 row... argh!!!
$result = mysql_query("SELECT $fields FROM company where company_id = $company_id");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

  # column 1
  echo "<table border=1 width=\"100%\">\n<tr>\n<td valign=\"top\">\n";
  echo $row["company_name"] . "<br>";
  echo $row["url"] . "<br>";
  echo $row["address1"] . "<br>";
  echo $row["address2"] . "<br>";
  echo $row["city"] . ", ";
  echo $row["state_id"] . ", ";
  echo $row["zip"] . "\n";
  echo "</td>\n";

  # column 2
  echo "<td valign=\"top\">\n";
  echo "Attention: " . $row["contact_name"] . ", ";
  echo $row["contact_title"] . "<br>";
  echo "Email: " . $row["contact_email"] . "<br>";
  echo "Phone: (" . $row["phone_area"] . ") " . $row["phone_exchange"] . "-" . $row["phone_digits"] . ", ext. " . $row["phone_extension"] . "<br>\n";
  echo "Fax: (" . $row["fax_area"] . ") " . $row["fax_exchange"] . "-" . $row["fax_digits"] . ", ext. " . $row["fax_extension"];
  echo "</td>\n</tr>\n</table>\n";

}

?>
