Can I Get Company Id On Function/smarty From Database?

$company_id = db_get_field("SELECT company_id FROM ?:company WHERE company_id = ?i"
something like this getting the company id from database?

If you mean multi-storefront, please use $runtime.company_id variable in Smarty template

Won't work if running single storefront that's been upgraded from years past.... Not sure about new stores. Use

{""|fn_get_runtime_company_id}

instead.

Old conversion hacks in early 4.x where they did not migrate company_id = 0 to company_id = 1 for single site installations. Here's the logic used:

function fn_get_runtime_company_id()
{
    $company_id = Registry::ifGet('runtime.company_id', 0);
    if (!$company_id && Registry::get('runtime.simple_ultimate')) {
        $company_id = Registry::get('runtime.forced_company_id');
    }
return $company_id;

}

Thanks for the clarification

Thanks guys, i appreciate the help