當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DBAccess::getConnection方法代碼示例

本文整理匯總了PHP中DBAccess::getConnection方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBAccess::getConnection方法的具體用法?PHP DBAccess::getConnection怎麽用?PHP DBAccess::getConnection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DBAccess的用法示例。


在下文中一共展示了DBAccess::getConnection方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: display

    function display($tpl = null)
    {
        global $mainframe, $option;
        $mainframe = JFactory::getApplication();
        $db = JFactory::getDBO();
        $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', '', 'string');
        if (strpos($search, '"') !== false) {
            $search = str_replace(array('=', '<'), '', $search);
        }
        $search = JString::strtolower($search);
        $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
        $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
        //	echo $limitstart;
        //	echo $limit;
        $where = array();
        if ($search) {
            $where[] = 'LOWER(pn_poly_name) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
        }
        $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
        //	if($limiter || $limit) {
        $limiter = ' LIMIT ' . $limitstart . ', ' . $limit;
        //	}
        $mysqli = DBAccess::getConnection();
        $query = 'SELECT * from pn_lenses_polymers';
        $result = $mysqli->selectQuery($query);
        $total = $result->num_rows;
        //	echo $total;
        jimport('joomla.html.pagination');
        $pagination = new JPagination($total, $limitstart, $limit);
        //$mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
        $query = 'SELECT * from pn_lenses_polymers ' . $where . ' ORDER BY pn_poly_name' . $limiter;
        $result = $mysqli->selectQuery($query);
        while ($obj = $result->fetch_object()) {
            $polymers[] = $obj;
        }
        foreach ($polymers as $poly) {
            switch ($poly->pn_fda_grp) {
                case 1:
                    $poly->pn_fda_grp = 'Low Water (<50 percent water content), Nonionic Polymers.<br />This group has the greatest resistance to protein deposition due
to its lower water content and nonionic nature. Heat, chemical, and hydrogen peroxide care regimens can be used.';
                    break;
                case 2:
                    $poly->pn_fda_grp = 'High Water (greater than 50 percent water content), Nonionic Polymers.<br />The higher water content of this group results in g
reater protein attraction than with group 1. However, the nonionic polymers reduce the potential for further attraction. Heat disinfection should be a
voided because of the high water content. In addition, sorbic acid and potassium sorbate preservatives can discolor the lenses.';
                    break;
                case 3:
                    $poly->pn_fda_grp = 'Low Water (less then 50 percent water content), Ionic Polymers.<br />The lower water content but ionic nature of these polymers
 results in intermediate protein resistance. Heat, chemical and hydrogen peroxide care systems may be used.';
                    break;
                case 4:
                    $poly->pn_fda_grp = 'High Water (greater then 50 percent water content), Ionic Polymers.<br />Because of the high water content and ionic nature of
these polymers they attract more proteins than any other group. It is best to avoid heat disinfection and sorbic acid preservatives.';
                    break;
            }
        }
        $this->assignRef('polymers', $polymers);
        $this->assignRef('pagination', $pagination);
        parent::display($tpl);
    }
開發者ID:grlf,項目名稱:eyedock,代碼行數:60,代碼來源:view.html.php

示例2: deletePolymer

 function deletePolymer($id)
 {
     $mysqli = DBAccess::getConnection();
     //$mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'DELETE from pn_lenses_polymers where pn_poly_tid = ' . $id;
     echo $query;
     if ($result = $mysqli->selectQuery($query)) {
         return true;
     } else {
         return false;
     }
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:12,代碼來源:pnpolymers.php

示例3: display

 function display($tpl = null)
 {
     global $mainframe, $option;
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', '', 'string');
     if (strpos($search, '"') !== false) {
         $search = str_replace(array('=', '<'), '', $search);
     }
     $search = JString::strtolower($search);
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     //	echo $limitstart;
     //	echo $limit;
     $where = array();
     if ($search) {
         //echo $search;
         $where[] = 'LOWER(name) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     //	if($limiter || $limit) {
     $limiter = ' LIMIT ' . $limitstart . ', ' . $limit;
     //	}
     $mysqli = DBAccess::getConnection();
     $query = 'SELECT * from pn_lenses_companies';
     $result = $mysqli->selectQuery($query);
     $total = $result->num_rows;
     //	echo $total;
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     //$mysqli = getSQLI();
     $query = 'SELECT * from pn_lenses_companies ' . $where . ' ORDER BY pn_comp_name' . $limiter;
     //echo $query;
     $result = $mysqli->selectQuery($query);
     if ($result) {
         while ($obj = $result->fetch_object()) {
             $companies[] = $obj;
         }
     }
     $this->assignRef('search', $search);
     $this->assignRef('companies', $companies);
     $this->assignRef('pagination', $pagination);
     $this->addToolBar();
     parent::display($tpl);
 }
開發者ID:irovast,項目名稱:eyedock,代碼行數:45,代碼來源:view.html.php

示例4: display

 function display($tpl = null)
 {
     global $mainframe, $option;
     $db = JFactory::getDBO();
     $mainframe = JFactory::getApplication();
     $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', '', 'string');
     if (strpos($search, '"') !== false) {
         $search = str_replace(array('=', '<'), '', $search);
     }
     $search = JString::strtolower($search);
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     //	echo $limitstart;
     //	echo $limit;
     $where = array();
     if ($search) {
         $where[] = 'LOWER(l.pn_name) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     //	if($limiter || $limit) {
     $limiter = ' LIMIT ' . $limitstart . ', ' . $limit;
     //	}
     $mysqli = DBAccess::getConnection();
     //$mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'SELECT pn_tid from pn_lenses';
     $result = $mysqli->selectQuery($query);
     $total = $result->num_rows;
     //	echo $total;
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $query = 'SELECT l.*, comp.pn_comp_name as companyname, pn_updated as updated, pn_discontinued as discontinued, pn_display as display, pn_bifocal as bifocal, pn_toric as toric, pn_cosmetic as cosmetic, poly.pn_poly_name as polymername from pn_lenses l left join pn_lenses_companies comp on (l.pn_comp_id = comp.pn_comp_tid) left join pn_lenses_polymers poly on (l.pn_poly_id = poly.pn_poly_tid)' . $where . ' ORDER BY l.pn_name' . $limiter;
     //	echo $query;
     $result = $mysqli->selectQuery($query);
     while ($obj = $result->fetch_object()) {
         $lenses[] = $obj;
     }
     $this->assignRef('lenses', $lenses);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:40,代碼來源:view.html.php

示例5: getPowerHTMLforLens

function getPowerHTMLforLens($lens)
{
    $mysqli = DBAccess::getConnection();
    $powerSQL = "SELECT variation,\tbaseCurve,\tdiameter, sphere, cylinder,\taxis, addPwr, colors_enh, colors_opq FROM pn_lenses_powers WHERE lensID = " . $lens['tid'];
    $result = $mysqli->selectQuery($powerSQL);
    $pwrCount = $result->num_rows;
    $html = "";
    $variation = 1;
    while ($powerRow = $result->fetch_assoc()) {
        $array[0] = $powerRow;
        //the formatNumberText function expects a 2D array
        $power = formatNumberText($array);
        $power = $power[0];
        //change it back to a 1D array
        //$variationLabel = ($power['variation'] !="")?$power['variation'] :$variation;
        if ($pwrCount > 1) {
            $html .= "\n -- Variation " . $variation . " --\n";
        }
        $html .= " -Base Curve: " . $power['baseCurve'] . "\n";
        $html .= " -Diameter: " . $power['diameter'] . "\n";
        $html .= " -Sphere: \n" . $power['sphere'] . "\n\n";
        if ($lens['toric'] == 1) {
            $html .= " -Cyl Power: " . $power['cylinder'] . "\n";
            $html .= " -Cyl Axis: " . $power['axis'] . "\n";
        }
        if ($lens['bifocal'] == 1) {
            $html .= " -Add power:  " . $power['addPwr'] . " \n";
        }
        if ($lens['cosmetic'] == 1) {
            $html .= " -Colors (enhancers):  " . $power['colors_enh'] . "\n";
            $html .= " -Colors (opaque):  " . $power['colors_opq'] . "\n";
        }
        //$html .= "\n";
        $variation++;
    }
    return $html;
}
開發者ID:irovast,項目名稱:eyedock,代碼行數:37,代碼來源:companyFunctions.php

示例6: array_push

    $pwrRow['id'] = $rxString;
    $pwrRow['label'] = $rxString . " (CL power)";
    $pwrRow['type'] = "power";
    $pwrRow['rx'] = $rxString;
    array_push($return, $mrRow);
    array_push($return, $pwrRow);
}
if ($which == "scl" && $onlyRx != 1) {
    //break all the words into a single array
    $phrase_array = explode(" ", $q);
    foreach ($phrase_array as $value) {
        $name[] = " pn_name LIKE '%{$value}%' ";
        $alias[] = " pn_aliases LIKE '%{$value}%' ";
        $company[] = " pn_comp_name LIKE '%{$value}%' ";
    }
    $nameString = implode(" AND ", $name);
    $aliasString = implode(" AND ", $alias);
    $companyString = implode(" AND ", $company);
    $where[] = "   ( ({$nameString}) OR ({$aliasString}) OR ({$companyString}) ) ";
    $where = implode(" AND ", $where);
    $sql = "SELECT pn_tid as id, pn_name as label, '{$which}' as type\n\t\tFROM pn_lenses \n\t\tLEFT JOIN pn_lenses_companies ON pn_comp_tid = pn_comp_id\n\t\tWHERE\n\t\t{$where} \n\t\tORDER BY pn_name";
    //echo($sql);
    //$db = databaseObj();
    //$db->setQuery($sql);
    $mysqli = DBAccess::getConnection();
    $result = $mysqli->selectQuery($sql);
    while ($row = $result->fetch_assoc()) {
        array_push($return, $row);
    }
}
echo json_encode($return);
開發者ID:grlf,項目名稱:eyedock,代碼行數:31,代碼來源:search_lenses.php

示例7: deleteCompany

 function deleteCompany($id)
 {
     $mysqli = DBAccess::getConnection();
     $query = 'DELETE from pn_lenses_companies where pn_comp_tid = ' . $id;
     //echo $query;
     if ($result = $mysqli->selectQuery($query)) {
         return true;
     } else {
         return false;
     }
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:11,代碼來源:pncompanies.php

示例8: deleteLens

 function deleteLens($id)
 {
     $mysqli = DBAccess::getConnection();
     //$mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'DELETE from pn_lenses where pn_tid = ' . $id;
     //echo $query;
     //TMZ added: now we need to delete the rows in the pn_lenses_powers table assoc with this lens.
     $resultarr[] = $mysqli->selectQuery($query);
     $query = 'DELETE from pn_lenses_powers where lensID = ' . $id;
     //also delete the corresponding pn_lenses_power_lists table
     $query2 = 'DELETE from pn_lenses_power_lists where id = ' . $id;
     $resultarr[] = $mysqli->selectQuery($query2);
     //echo $query;
     $resultarr[] = $mysqli->selectQuery($query);
     return !in_array(false, $resultarr) ? true : false;
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:16,代碼來源:pnlenses.php


注:本文中的DBAccess::getConnection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。