\n"; $company = dbQuery($sql); if (mysql_num_rows($company) > 0 ) { $company = mysql_fetch_object($company); $page_title = $company->company." - Company Details - Contract Services Directory"; $content = "

Companies » Company Details


\n"; $content .= "
\n"; $content .= "\n"; if ($company->logo) $content .= "\n"; $content .= "\n"; $content .= "
\n"; else $content .= "
\n"; $content .= "

".$company->company."

\n"; $content .= "
\n"; if ($company->logo_linked) $content .= "\n"; if ($company->logo) $content .= "".$company->company." Logo\n"; if ($company->logo_linked) $content .= "\n"; $content .= "
\n"; $content .= "
\n"; $content .= "\n"; $content .= "\n"; if ( ($company->company_fname) || ($company->company_lname) || ($company->phone1) || ($company->phone2) || ($company->fax) || ($company->website) ) { $content .= "\n"; } if ( ($company->address) || ($company->city) || ($company->state) || ($company->zip) || ($company->country) ) { $content .= "\n"; } $content .= "\n"; $content .= "

Contact:


\n"; if (($company->company_fname) && ($company->company_lname)) $content .= $company->company_fname.' '.$company->company_lname."
\n"; if ($company->company_title) $content .= $company->company_title."
\n"; if ($company->phone1) $content .= "Phone #: {$company->phone1}
\n"; if ($company->phone2) $content .= "Phone #: {$company->phone2}
\n"; if ($company->fax) $content .= "Fax #: {$company->fax}
\n"; //if ($company->company_public_email) echo "Email: {$company->company_public_email}
\n"; if ($company->company_public_email) $content .= "Email: {$company->company_public_email}
\n"; if ($company->website) { $content .= "Website: "; if ($company->website_linked) $content .= ""; $content .= $company->website; if ($company->website_linked) $content .= ""; } $content .= "

Address:


\n"; if ($company->address) $content .= str_replace("\n", "
", $company->address) . "
\n"; if ($company->city) $content .= $company->city; if ($company->state) $content .= ", {$company->state}"; if ($company->zip) $content .= " {$company->zip}
\n"; if ($company->country) $content .= $company->country . "
\n"; $content .= "
\n"; // check for custom fields // company description $strsql = "SELECT cf.cf_id, cf.field_name, cfv.field_name_value FROM bg_custom_fields cf LEFT JOIN bg_custom_field_values cfv ON cf.cf_id=cfv.cf_id AND rel_id_value=$company->comid WHERE cf.bg_id=$bg_id AND cf.field_name='50 word desc' AND cfv.field_name_value != '' ORDER BY cf.cf_order"; $custom_fields = dbQuery($strsql); if (mysql_num_rows($custom_fields)) { $content .= "

Company Description:

\n"; $cf = mysql_fetch_object($custom_fields); $content .= "
\n".$cf->field_name_value."
\n"; } // Corp Cap PDF $strsql = "SELECT cf.cf_id, cf.field_name, cfv.field_name_value FROM bg_custom_fields cf LEFT JOIN bg_custom_field_values cfv ON cf.cf_id=cfv.cf_id AND rel_id_value=$company->comid WHERE cf.bg_id=$bg_id AND cf.field_name='Corp Cap Link' AND cfv.field_name_value != '' ORDER BY cf.cf_order"; $custom_fields = dbQuery($strsql); if (mysql_num_rows($custom_fields)) { $content .= "
\n"; $content .= "

Additional Information:

\n"; $content .= "\n"; while ($cf = mysql_fetch_object($custom_fields)) { $content .= "\n"; $content .= "\n"; $content .= "\n"; $content .= "\n"; } // end while $content .= "
Corporate Capabilities PDF:"; if (substr($cf->field_name_value,0,4) == 'http') $content .= "Download"; else $content .= $cf->field_name_value; $content .= "
\n"; } // end if custom fields // display their categories //$strsql = "SELECT cat.category FROM bg_categories cat, bg_categories_companies catcom, bg_companies com WHERE com.comid={$c->comid} AND com.comid=catcom.comid AND catcom.catid=cat.catid ORDER BY category"; //echo $strsql; // this one gets categories with subcategories $strsql = "SELECT cat.category, cat.sub_of, cat2.category AS main_category FROM bg_categories cat, bg_categories cat2, bg_categories_companies catcom, bg_companies com WHERE com.comid={$company->comid} AND com.comid=catcom.comid AND catcom.catid=cat.catid AND cat.sub_of = cat2.catid ORDER BY cat2.category, cat.category"; $categories = dbQuery($strsql); $display_header = 1; if (mysql_num_rows($categories) > 0) { $col = 0; $row = 0; $display_header = 0; $old_category= ''; $content .= "
"; $content .= "

".$company->company." deals in the following categories:


\n"; while ($category = mysql_fetch_object($categories)) { if ($old_category != $category->main_category) { if ($old_category != '') $content .= "\n"; if ($category->main_category) $content .= "

{$category->main_category}

\n"; $content .= "
\n"; $content .= "\t\n"; } $row++; if ( ($row != 1) && ($col % 3 == 0) ) { $content .= "\t\n\t\n"; } // display column cell $content .= "\t\t\n"; $col++; $old_category = $category->main_category; } $content .= "\t\n
category)."'>{$category->category}
\n"; } // get categories that have no subcategories $strsql = "SELECT cat.category FROM bg_categories cat, bg_categories_companies catcom, bg_companies com WHERE cat.has_sub=0 AND cat.sub_of=0 AND com.comid={$company->comid} AND com.comid=catcom.comid AND catcom.catid=cat.catid ORDER BY category"; $categories = dbQuery($strsql); if (mysql_num_rows($categories)) { $col = 0; $row = 0; $old_category= ''; if ($display_header) $content .= "
\n

".$company->company." deals in the following categories:


\n"; else $content .= "
\n

Other categories:


\n"; $content .= "\n"; $content .= "\t\n"; while ($category = mysql_fetch_object($categories)) { $row++; if ( ($row != 1) && ($col % 2 == 0) ) $content .= "\t\n\t\n"; // display column cell $content .= "\t\t\n"; $col++; $old_category = $category->category; } $content .= "\t\n
{$category->category}
\n"; } $content .= "
\n"; $content .= "
\n"; //include($_SERVER['DOCUMENT_ROOT']."/$bg_dir/search.php"); //$content .= "

Edit this company

"; } else { $content .= "There were no companies that matched. Please go back and try again."; } } else if ($_GET['search'] == 'category') { $category = urldecode($_GET['term']); $page_title = $category." - Category Details"; $content = "

Category » $category


\n"; $content .= "
\n"; // check for sponsor // it's already in the header.php //$sponsor = getAd('top'); //if ($sponsor) $ad_code .= "\n\n$sponsor"; // if there is a main_category get that first and append the sub_of=maincatid... if ($main_category != '') { $strsql = "SELECT catid FROM bg_categories WHERE bg_id=$bg_id AND category='$main_category' AND has_sub=1 AND sub_of=0"; //echo "\n\n\n\n"; list($main_category_id) = mysql_fetch_array(dbQuery($strsql)); $sql = "SELECT catid FROM bg_categories WHERE bg_id=$bg_id AND category='$category' AND sub_of=$main_category_id"; //echo "\n\n\n\n"; } else { $main_category_id = 0; } // get featured // from search page //$strsql = "SELECT com.company, com.website_linked FROM bg_companies com, bg_categories_companies catcom, bg_categories cat WHERE cat.catid=$catid AND cat.bg_id=$bg_id AND cat.catid=catcom.catid AND catcom.comid=com.comid AND com.is_active=1 AND (com.website_linked=1 OR com.logo_linked=1) ORDER BY company"; $sql_featured = "SELECT com.comid, com.company, com.website_linked FROM bg_companies com, bg_categories_companies catcom, bg_categories cat WHERE cat.bg_id=$bg_id "; if ($main_category_id != 0) $sql_featured .= "AND cat.sub_of=$main_category_id "; $sql_featured .= "AND cat.category='$category' AND cat.catid=catcom.catid AND catcom.comid=com.comid AND com.is_active=1 AND (com.website_linked=1 OR com.logo_linked=1) ORDER BY company"; // get regular // from search page // $strsql = "SELECT com.company, com.website_linked FROM bg_companies com, bg_categories_companies catcom, bg_categories cat WHERE cat.catid=$catid AND cat.bg_id=$bg_id AND cat.catid=catcom.catid AND catcom.comid=com.comid AND com.is_active=1 AND website_linked=0 AND logo_linked=0 ORDER BY company"; $sql_regular = "SELECT com.company, com.website_linked FROM bg_companies com, bg_categories_companies catcom, bg_categories cat WHERE cat.bg_id=$bg_id "; if ($main_category_id != 0) $sql_regular .= "AND cat.sub_of=$main_category_id "; $sql_regular .= "AND cat.category='$category' AND cat.catid=catcom.catid AND catcom.comid=com.comid AND com.is_active=1 ORDER BY company"; // featured companies $companies = dbQuery($sql_featured); if (mysql_num_rows($companies) > 0) { $content .= "
\n"; $content .= "

Featured companies that provide $category:


\n"; $content .= "\n"; while ($company = mysql_fetch_object($companies)) { $highlighted = ' class="highlighted"'; $content .= "\t\t\t» ".$company->company."\n"; } $content .= "
\n"; $content .= "
\n"; } // end if // regular companies $companies = dbQuery($sql_regular); if (mysql_num_rows($companies) > 0) { $col = 0; $row = 0; $content .= "
\n"; $content .= "

The following companies provide $category:


\n"; $content .= "\n"; $content .= "\n"; while ($company = mysql_fetch_object($companies)) { $row++; if ( ($row != 1) && ($col % 2 == 0) ) { $content .= "\t\t\t\n\t\t\t\n"; } // display column cell $highlighted = ''; if ($company->website_linked) $highlighted = ' class="highlighted"'; $content .= "\t\t\t\t\n"; $col++; } $content .= "\n"; $content .= "
{$company->company}
\n"; $content .= "
\n"; $content .= "
\n"; //include($_SERVER['DOCUMENT_ROOT']."/$bg_dir/search.php"); } } } else if ($_GET['search'] == 'categories') { $page_title = "Category List - Contract Services Directory"; $content = "

View Company ListingContract Services Directory » Category Listing


\n"; $content .= "
\n"; // get categories with no sub-cats //$sql = "SELECT catid, category FROM bg_categories WHERE bg_id=$bg_id AND has_sub=0 AND sub_of=0 ORDER BY category"; //$categories = dbQuery($sql); // is now // get aphlabetical listing $sql = "SELECT DISTINCT substring(category, 1, 1) AS letter FROM bg_categories WHERE bg_id=$bg_id ORDER BY category"; $letters = dbQuery($sql); $content .= "
\n"; while (list($letter) = mysql_fetch_row($letters)) { $content .= "".strtoupper($letter)." "; } $content .= "
\n"; $content .= "
\n"; $content .= "\n"; $content .= "
\n"; // list categories alphabetically // split at K // get categories that have companies associated with them //$strsql = "SELECT DISTINCT c.comid, c.company, c.logo_linked, c.website_linked FROM bg_companies c, bg_categories_companies cc WHERE c.bg_id=$bg_id AND c.is_active=1 AND c.comid=cc.comid ORDER BY c.company"; //AND (logo_linked=0 AND website_linked=0) $sql = "SELECT DISTINCT c.catid, c.category, a.ad_id FROM bg_categories_companies cc, bg_categories c WHERE bg_id=$bg_id AND has_sub=0 AND sub_of=0 AND c.catid=cc.catid ORDER BY c.category"; $replace = ""; $sql = "SELECT DISTINCT c.catid, c.category, a.ad_id, ad.date_id FROM bg_categories_companies cc, bg_categories c LEFT JOIN web_ad_pages ap ON ap.url=CONCAT('http://www.contractpharma.com/csd/category/',REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(category, ' ', '%20'), ',', '%2C'), '/', '%252f'), '&', '%2526'), ':', '%3A'), '(', '%28'), ')', '%29')) LEFT JOIN web_ads a ON ap.ad_id=a.ad_id AND a.cid=$cid AND a.is_active=1 LEFT JOIN web_ad_dates ad ON a.ad_id=ad.ad_id AND ad.start_date<=NOW() AND ad.end_date>=NOW() WHERE bg_id=$bg_id AND has_sub=0 AND sub_of=0 AND c.catid=cc.catid ORDER BY c.category, a.ad_id DESC"; //$content .= "$sql

"; $categories = dbQuery($sql); $old_letter = ''; $new_column = 1; $old_category = ''; while ($c = mysql_fetch_object($categories)) { if ($old_category != $c->category) { $letter = strtoupper(substr($c->category, 0, 1)); //if (($letter > 'K') && ($old_letter != 'K')) { if (($letter > 'L') && ($new_column)) { $new_column = 0; $content .= "
\n"; } if ($old_letter != $letter) { $content .= "\n"; $content .= "\n"; $content .= "\n"; } if (!is_null($c->ad_id) && !is_null($c->date_id)) { $content .= "\n"; } else { $content .= "\n"; } $content .= "\n"; $content .= "\n"; $old_letter = $letter; $old_category = $c->category; } } $content .= "
$letterBack to top
 ".$c->category."
\n"; $content .= "
\n"; } // List Companies - default page } else { // featured companies listed first! //include($_SERVER['DOCUMENT_ROOT']."/$bg_dir/search.php"); $page_title = "Company Listing - Contract Services Directory"; $content = "\n"; $content .= "
\n"; $content .= "

Featured Companies

\n"; $content .= "
\n"; $content .= "
\n"; // list featured companies alphabetically $sql = "SELECT comid, company, logo_linked, website_linked FROM bg_companies WHERE bg_id=$bg_id AND is_active=1 AND (logo_linked=1 OR website_linked=1) ORDER BY company"; $companies = dbQuery($sql); $old_letter = ''; $split_at = floor(mysql_num_rows($companies)/2)+1; $row = 0; while ($c = mysql_fetch_object($companies)) { if ($row == $split_at) { $content .= "
\n"; } $row++; $content .= "\n"; } $content .= "
»".$c->company."
\n"; $content .= "
\n"; // get aphlabetical listing $sql = "SELECT DISTINCT substring(company, 1, 1) AS letter FROM bg_companies WHERE bg_id=$bg_id AND is_active=1 ORDER BY company"; $letters = dbQuery($sql); $content .= "
\n"; $content .= "

Company Listing



\n"; $content .= "
\n"; while (list($letter) = mysql_fetch_row($letters)) { $content .= "".strtoupper($letter)." \n"; } $content .= "
\n"; $content .= "
\n"; $content .= "\n"; $content .= "
\n"; // list companies alphabetically // split at K $sql = "SELECT DISTINCT c.comid, c.company, c.logo_linked, c.website_linked FROM bg_companies c, bg_categories_companies cc WHERE c.bg_id=$bg_id AND c.is_active=1 AND c.comid=cc.comid ORDER BY c.company"; //AND (logo_linked=0 AND website_linked=0) $companies = dbQuery($sql); $old_letter = ''; while ($c = mysql_fetch_object($companies)) { $letter = strtoupper(substr($c->company, 0, 1)); if (($letter == 'K') && ($old_letter != 'K')) { $content .= "
\n"; } if ($old_letter != $letter) { $content .= "\n"; $content .= "\n"; $content .= "\n"; } if (($c->logo_linked) || ($c->website_linked)) { $content .= "\n"; $content .= "\n"; $content .= "\n"; } else { $content .= "\n"; $content .= "\n"; $content .= "\n"; } $old_letter = $letter; } $content .= "
$letterBack to top
»".$c->company."
 ".$c->company."
\n"; $content .= "\n"; $content .= "

Not Listed? Sign Up!

\n"; $content .= "\n"; $content .= "

Want to add your company to the Contract Pharma Contract Services Directory? Fill out the following fields, click SUBMIT, and you'll receive an e-mail within 48 hours with a username and password that will allow you to build your company's Contract Services Directory profile.

\n"; $content .= "
\n"; $content .= "\n"; $content .= "\n"; $content .= "\n"; $content .= "\n"; $content .= "\n"; $content .= "
First Name:
Last Name:
Email:
Company:
\n"; $content .= "\n"; $content .= "
\n"; $content .= "

\n"; $content .= "Or download the Directory Form PDF, fill it out, and fax it back to us at 201-825-0553!\n"; $content .= "
\n"; } include($_SERVER['DOCUMENT_ROOT'].'/includes/php/header_csd.php'); echo $content; include($_SERVER['DOCUMENT_ROOT'].'/includes/php/footer.php'); ?>