本文整理汇总了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);
}
示例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;
}
}
示例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);
}
示例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);
}
示例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;
}
示例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);
示例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;
}
}
示例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;
}