function companysearch_companypage () {
$header = array('Ticker', 'Company', 'Sector', 'Industry');
$name = '%'.urldecode(arg(1)).'%';
$results = db_query("SELECT a.nid, a.title, b.field_ticker_value, d.tid, d.name FROM {node} a LEFT JOIN {node_content_company} b ON a.nid = b.nid
LEFT JOIN {term_node} c ON c.nid = b.nid LEFT JOIN {term_data} d ON d.tid = c.tid WHERE a.type = 'content_company'
AND title LIKE '%s' ORDER BY a.title", $name);
$sect = db_fetch_object(db_query("SELECT a.title, d.tid, d.name FROM {node} a LEFT JOIN {term_node} b ON b.nid = a.nid LEFT JOIN {term_hierarchy} c ON c.tid = b.tid
LEFT JOIN {term_data} d ON d.tid = c.parent WHERE a.type = 'content_company'
AND title LIKE '%s' ORDER BY a.title", $name));
$rows = array();
while ( $data = db_fetch_object($results)){
$rows[] = array(l($data->field_ticker_value, "node/$data->nid", array('title' => t('Company info')), NULL, NULL, FALSE, FALSE), $data->title, l($sect->name, 'taxonomy/term/'.$sect->tid, NULL, NULL, FALSE, FALSE), l($data->name, 'taxonomy/term/'.$data->tid, NULL, NULL, FALSE, FALSE));
}
$output = theme('table', $header, $rows, array('border' => '3', 'align' => 'center'));
return ($output);
}