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


PHP Sql類代碼示例

本文整理匯總了PHP中Sql的典型用法代碼示例。如果您正苦於以下問題:PHP Sql類的具體用法?PHP Sql怎麽用?PHP Sql使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: listaDestinatarios

 public function listaDestinatarios($_prComunicado)
 {
     $sb = new StringBuilder();
     $Sql = new Sql();
     $sb->append("SELECT *");
     $sb->append("FROM " . T_COMEMP);
     $sb->append("LEFT JOIN");
     $sb->append(T_EMP);
     $sb->append("ON codigo_emp = empregado_coe");
     $sb->append(sprintf("WHERE comunicado_coe = %s", $_prComunicado));
     return $Sql->executaSQL($sb->toString());
 }
開發者ID:jhonleandres,項目名稱:estagio,代碼行數:12,代碼來源:ComunicadosDAO.php

示例2: logar

 public function logar(Login $login)
 {
     $Sql = new Sql();
     $sb = new StringBuilder();
     $sb->append("SELECT *");
     $sb->append("FROM " . T_USUARIO);
     $sb->append(sprintf("WHERE login_usr = %s", $login->getLoginUsr()));
     $sb->append(sprintf("AND senha_usr = %s", $login->getSenhaUsr()));
     $sb->append("AND ativo_usr = 1");
     $retorno = $Sql->ExecutaSQL($sb->toString());
     if (count($retorno) > 0) {
         global $Sess;
         // Dados do Usuario Logado
         $Sess->usuario = $retorno[0];
         // Atualiza o usuário
         $usuario = new Usuarios();
         $usuario->setCodigoUsr(toNumero($retorno[0]['codigo_usr']));
         $usuario->setUltimoacessoUsr(toDateTime());
         $this->alterar($usuario);
         // inicia Sessao
         $Sess->logado_sys = true;
         $Sess->ultimoacesso_sys = time();
         return true;
     }
     return false;
 }
開發者ID:jhonleandres,項目名稱:estagio,代碼行數:26,代碼來源:LoginDAO.php

示例3: enviar

 public function enviar()
 {
     try {
         $Sql = new Sql();
         $Sql->inicio();
         $agendaDAO = new AgendaDAO();
         $agenda = $agendaDAO->consultaCodigo(toNumero(GetVar('agenda')));
         $empregadosDAO = new EmpregadosDAO();
         $destinatarios = $empregadosDAO->listarSelecao(GetVar('destinatarios'));
         $emailController = new EmailController();
         $listaEmail = array();
         foreach ($destinatarios as $key => $empregado) {
             if ($empregado['email_emp'] != "") {
                 $listaEmail[] = array("email" => $empregado['email_emp'], "nome" => $empregado['nome_emp']);
             }
             $agendaEnviadoEmpreg = new AgendaEnviadoEmpreg();
             $agendaEnviadoEmpreg->setAgendaAee(toNumero(GetVar('agenda')));
             $agendaEnviadoEmpreg->setEmpregadoAee(toNumero($empregado['codigo_emp']));
             $agendaDAO->cadastrar($agendaEnviadoEmpreg, $codigo_aee, $Sql);
         }
         $emailController->setAssunto("Agendamento de Entrevista");
         $emailController->setConteudo($this->montaAgendamento($agenda[0]));
         $emailController->setListaEmail($listaEmail);
         $return = $emailController->enviarEmail();
         if (is_string($return)) {
             throw new Exception($return);
         }
         $Sql->commit($return);
         $result = $return ? 'Comunicado de Agendamento enviado com sucesso.' : 'Erro ao enviar Comunicado de Agendamento.';
         echo json_encode(array("success" => is_string($return) ? false : $return, "msg" => is_string($return) ? $return : $result));
     } catch (Exception $e) {
         echo json_encode(array("success" => false, "msg" => $e->getMessage()));
     }
 }
開發者ID:jhonleandres,項目名稱:estagio,代碼行數:34,代碼來源:AgendaController.php

示例4: updateComprovante

 public function updateComprovante($id, $parcela, $data, $nome_comprovante)
 {
     $sql = new Sql();
     $sql->conn_bd();
     $query = 'UPDATE parcelas SET data = "' . $data . '" , comprovante = "' . $nome_comprovante . '" WHERE parcela_n = ' . $parcela . ' && id_conta = ' . $id . '';
     mysql_query($query);
 }
開發者ID:AndMorMat,項目名稱:backSis,代碼行數:7,代碼來源:class_parcelas_bd.php

示例5: verificaCli

 public function verificaCli($user, $pass)
 {
     $sql = new Sql();
     $sql->conn();
     $query = "SELECT * FROM usuario";
     //WHERE user = '".$user."' && senha = ".$pass;
     $result = mysql_query($query);
     $cont = 0;
     while (mysql_fetch_array($result)) {
         // $usuario = $row['user'];
         // $senha = $row['senha'];
         $cont++;
         //return true;
     }
     // 		$sql = "SELECT * FROM tabela WHERE id=$id";
     // $query = mysql_query($sql);
     // while($sql = mysql_fetch_array($query)){
     // $nome = $sql["nome"];
     // echo "Resultados para o ID $idNome:$nome";
     // }
     if ($cont > 0) {
         return true;
     } else {
         return false;
     }
 }
開發者ID:AndMorMat,項目名稱:ecomerce,代碼行數:26,代碼來源:class-cliente-bd.php

示例6: search

 public function search()
 {
     $response = "";
     $sqlhandler = new Sql();
     if ($this->client) {
         $sql = "SELECT * FROM `choice` WHERE content LIKE '%{$this->content}%' LIMIT 0, 1 ";
     } else {
         $sql = "SELECT * FROM `choice` WHERE content LIKE '%{$this->content}%'";
     }
     if ($result = $sqlhandler->excute_query($sql)) {
         if ($result->num_rows == 0) {
             return $this->send_ms("暫時還沒有隊友碰到這題。");
         }
         while ($row = $result->fetch_assoc()) {
             $key = htmlspecialchars(strtoupper($row['c_key']));
             $time = date('g:i A d / M / Y D', $row['c_time']);
             $content = htmlspecialchars(stripcslashes($row['content']));
             $user = htmlspecialchars(stripcslashes($row['c_user']));
             if ($this->client) {
                 $response .= $content . "|" . $key . "|" . $user;
             } else {
                 $response .= "<p><strong>題目:</strong><span><pre>{$content}</pre></span></p><p><strong>答案:</strong><span class=\"answer\">{$key}</span></p><p class=\"post_info\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span> {$user} &nbsp;&nbsp;&nbsp;&nbsp; <span class=\"glyphicon glyphicon-time\" aria-hidden=\"true\"></span> {$time}</p>";
             }
             //$response .= "{\"content\": \"{$content}\", \"key\": \"{$key}\", \"user\": \"{$user}\", \"time\": \"{$time}\"},";
         }
         //$response = rtrim($response, ',') . "]";
         //<p><strong>題目:</strong><span><pre>{$content}</pre></span></p><p><strong>答案:</strong><span class=\"answer\">{$key}</span></p><p class=\"post_info\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span> {$user} &nbsp;&nbsp;&nbsp;&nbsp; <span class=\"glyphicon glyphicon-time\" aria-hidden=\"true\"></span> {$time}</p>";
     }
     return $this->send_ms($response);
 }
開發者ID:Yang-ZL,項目名稱:Cooperative-problem-solving-system,代碼行數:30,代碼來源:class.php

示例7: getOrderedByName

 /**
  * Returns all states ordered by name
  *
  * @return TableEntitySetInterface
  */
 public function getOrderedByName()
 {
     $sql = new Sql($this->getAdapter());
     $select = $sql->select();
     $select->from($this->tableGateway->getTable());
     $select->order('state_name asc');
     return $this->tableGateway->selectWith($select);
 }
開發者ID:ponchov,項目名稱:teeforall,代碼行數:13,代碼來源:State.php

示例8: limpa_materiais_produto

 public function limpa_materiais_produto($id_produto)
 {
     $sql = new Sql();
     $sql->conn_bd();
     $g = new Glob();
     $query = "DELETE FROM produto_materiais WHERE id_produto = '%s'";
     $result = $g->tratar_query($query, $id_produto);
 }
開發者ID:pwatanabe,項目名稱:sgo,代碼行數:8,代碼來源:class_produto_materiais_bd.php

示例9: __construct

 public function __construct($name)
 {
     $s = new Sql();
     $connect = $s->connectToDatabase('recruit');
     $jbID = $s->createJobPosition($connect, $name);
     $this->jpID = $jbID;
     $this->jobPositionName = $name;
 }
開發者ID:vbalalla,項目名稱:project_CV_and_Recruitment_Management,代碼行數:8,代碼來源:jobPosition.php

示例10: getStatus

 public function getStatus()
 {
     $s = new Sql();
     $connect = $s->connectToDatabase('recruit');
     $data = mysqli_query($connect, "SELECT sessionstatus.status FROM sessionstatus,recruitmentsession WHERE recruitmentsession.sessionStatusID=sessionstatus.sessionStatusID AND RSID='{$this->RSID}'");
     $row = $data->fetch_row();
     return $row[0];
 }
開發者ID:vbalalla,項目名稱:project_CV_and_Recruitment_Management,代碼行數:8,代碼來源:RecruitmentSession.php

示例11: eliminarCategoria

 public function eliminarCategoria($id)
 {
     $sql = new Sql();
     $sql->addTable('tipos');
     $sql->setOpcion('delete');
     $sql->addWhere("`idTipo =`" . $id);
     Persistence::eliminar($sql);
 }
開發者ID:johncuervo24,項目名稱:EjPHP,代碼行數:8,代碼來源:Tipo.php

示例12: setThresholdPeriod

 public function setThresholdPeriod($thresholdPeriod)
 {
     $this->thresholdPeriodYears = $thresholdPeriod;
     $s = new Sql();
     global $databaseName;
     $connectValue = $s->connectToDatabase($databaseName);
     $row = $s->insertToConfig($connectValue, $thresholdPeriod);
 }
開發者ID:vbalalla,項目名稱:project_CV_and_Recruitment_Management,代碼行數:8,代碼來源:threshold.php

示例13: eliminarDetalleProductoSucursalByProductolId

 public function eliminarDetalleProductoSucursalByProductolId($id)
 {
     $sql = new Sql();
     $sql->addTable('detalleProductoSucursales');
     $sql->setOpcion('delete');
     $sql->addWhere("`pedidoId =`" . $id);
     Persistence::eliminar($sql);
 }
開發者ID:johncuervo24,項目名稱:EjPHP,代碼行數:8,代碼來源:DetalleProductoSucursal.php

示例14: testBindISO8601DateValue

 /**
  * @covers Gacela\DataSource\Query\Sql::bind
  * @dataProvider providerDates
  */
 public function testBindISO8601DateValue($date, $bound)
 {
     $time = time();
     $this->object->where('date = :date', array(':date' => $date));
     $where = $this->object->where;
     list($sql, $binds) = $this->object->assemble();
     $this->assertSame($bound, $binds[':date']);
 }
開發者ID:energylab,項目名稱:gacela,代碼行數:12,代碼來源:SqlTest.php

示例15: atualiza_cbo_x_exames

 public function atualiza_cbo_x_exames($id_cbo, $array_id_exames)
 {
     $sql = new Sql();
     $sql->conn_bd();
     $g = new Glob();
     mysql_query("DELETE FROM cbo_exames WHERE id_cbo = " . $id_cbo);
     $this->add_cbo_x_exames($array_id_exames, $id_cbo);
 }
開發者ID:pwatanabe,項目名稱:sgo,代碼行數:8,代碼來源:class_cboXexames.php


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