当前位置: 首页>>代码示例>>PHP>>正文


PHP Database::getResult方法代码示例

本文整理汇总了PHP中Database::getResult方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::getResult方法的具体用法?PHP Database::getResult怎么用?PHP Database::getResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Database的用法示例。


在下文中一共展示了Database::getResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: changePassword

 public function changePassword($pwd)
 {
     if (empty($pwd->current)) {
         return 'Current password is required.';
     }
     if (empty($pwd->new)) {
         return 'New password cannot be blank.';
     }
     if (empty($pwd->confirm) || $pwd->new != $pwd->confirm) {
         return "Passwords don't match";
     }
     if (strlen($pwd->new) < 5) {
         return 'Password is too short';
     }
     $db = new Database();
     $db->select('Users', 'Email', null, "StudentId is null and Email ='" . $pwd->email . "' and Password=password('" . $pwd->current . "');");
     $res = $db->getResult();
     if (!array_key_exists('Email', $res)) {
         return 'Wrong password';
     }
     if (!$db->sql("UPDATE Users SET Password=password('" . $pwd->new . "') WHERE StudentId is null and Email ='" . $pwd->email . "' and Password=password('" . $pwd->current . "');")) {
         $res = $db->getResult();
         return $res;
     }
     return true;
 }
开发者ID:M7ammed,项目名称:Mobile-Judge-App,代码行数:26,代码来源:Settings.php

示例2: buscar

function buscar($b)
{
    include 'crud/class/mysql_crud.php';
    $db = new Database();
    $db->connect();
    $db->select('proveedor', 'idproveedor, razonsocial, numerodoc', NULL, ' UPPER(numerodoc) LIKE "%' . strtoupper($b) . '%"', NULL, '1');
    // Table name, Column Names, WHERE conditions, ORDER BY conditions
    $res = $db->getResult();
    $contar = $db->numRows();
    if ($contar == 0) {
        echo "No se han encontrado resultados para '<b>" . $b . "</b>'.";
    } else {
        foreach ($res as $key => $value) {
            //$name = $value['numerodoc'].'|'.$value['razonsocial'].'|'.$value['idproveedor'];
            //array_push($data, $name);
            $id = $value['idproveedor'];
            $razonsocial = $value['razonsocial'];
            $numerodoc = $value['numerodoc'];
            $data = array('idproveedor' => $id, 'razonsocial' => $razonsocial, 'numerodoc' => $numerodoc);
            //echo $data['razonsocial'];
        }
        echo json_encode($data);
        exit;
    }
}
开发者ID:ramikat,项目名称:ERPSIS,代码行数:25,代码来源:busprov_1.php

示例3: remove

 public function remove($id)
 {
     $db = new Database();
     $db->delete('Questions', 'id=' . $id);
     $res = $db->getResult();
     return array('success' => $res[0] === 1);
 }
开发者ID:M7ammed,项目名称:Mobile-Judge-App,代码行数:7,代码来源:Questions.php

示例4: searchVideos

  public function searchVideos($pSrchString)
  {
    if (strlen($pSrchString) > 0)
    {
      $lSrchString = trim($pSrchString);
      $lSplitter = preg_split('/\s+/', $lSrchString);
	  
      if (count($lSplitter) > 0)
      {
        $lStatement = "SELECT ID, VideoTitle, Duration FROM VideoDB WHERE 1=1 ";
		
         foreach ($lSplitter as $lKey => $lValue)
           $lStatement .= " AND VideoTitle like '%$lValue%'";
	  
         $lStatement .= " LIMIT 0," . Config::$YoutubeMaxLocalResults;
	  
        $lDB = new Database();
        $lDB->connect();  
	  
        $lDB->select($lStatement);  
        $lResult = $lDB->getResult();
        $lDB->disconnect(); 
      }
    }
	
    return($lResult);	
  }
开发者ID:nikunjkacha,项目名称:MPFree,代码行数:27,代码来源:Videos.php

示例5: fin_notificaciones

 public static function fin_notificaciones()
 {
     ///$configdb = new Mysql('localhost','root','','corsione');
     $configdb = new Database();
     $configdb->connect();
     $configdb->update('notificaciones', array('estado' => "1"), 'estado="0"');
     $res = $configdb->getResult();
 }
开发者ID:acampos1916,项目名称:corcione_produccion,代码行数:8,代码来源:Note.php

示例6: commit

 /**
  * Commit current tracking data.
  * @param $groupId
  */
 public function commit($groupId)
 {
     $sql = "UPDATE dbtrack_actions SET groupid = :groupid WHERE groupid = 0";
     $this->dbms->executeQuery($sql, array('groupid' => $groupId));
     // Count new actions.
     $count = $this->dbms->getResult('SELECT COALESCE(COUNT(id), 0) AS actions FROM dbtrack_actions WHERE groupid = :groupid', array('groupid' => $groupId));
     return $count->actions;
 }
开发者ID:sadreck,项目名称:dbtrack_old,代码行数:12,代码来源:DBManager.php

示例7: getId

 public function getId($id)
 {
     $db = new Database();
     $db->connect();
     $sql = "select id, fullname from feedback_db where id={$id}";
     $db->selectJoin($sql);
     return $db->getResult();
 }
开发者ID:kansaipaint,项目名称:feedback,代码行数:8,代码来源:feedback.php

示例8: testGetResultWrongParam

 public function testGetResultWrongParam()
 {
     $db = new Database();
     $get_logs_stmt = $db->prepare('SELECT id FROM Users');
     $get_logs_stmt->execute();
     $results = $db->getResult($db);
     $this->assertTrue(empty($results));
 }
开发者ID:Jsnrkd,项目名称:Walleye,代码行数:8,代码来源:DatabaseTest.php

示例9: select

 function select()
 {
     $db = new Database();
     $db->connect();
     $db->select('CRUDClass', 'id,name', NULL, 'name="Name 1"', 'id DESC');
     // Table name, Column Names, JOIN, WHERE conditions, ORDER BY conditions
     $res = $db->getResult();
     print_r($res);
 }
开发者ID:chamalC,项目名称:mysql-crud,代码行数:9,代码来源:connect-db.php

示例10: getAll

 public function getAll()
 {
     $db = new Database();
     $db->select('History');
     $res = $db->getResult();
     if (array_key_exists('id', $res)) {
         $res = array($res);
     }
     return array('total' => count($res), 'data' => $res);
 }
开发者ID:M7ammed,项目名称:Mobile-Judge-App,代码行数:10,代码来源:History.php

示例11: get_asignado

 public static function get_asignado($usuario)
 {
     //DB Conection
     $db = new Database();
     $db->connect();
     $sql = "SELECT CONCAT_WS(' ', IF(nombre != '', nombre, ''), IF(apellido != '', apellido, '')) AS nombre_completo, email, HEX(uuid_usuario) as uuid_usuario FROM usuarios WHERE uuid_usuario IN('" . $usuario . "')\n\t\t\t\tAND status = 'Activo'";
     $db->sql($sql);
     $results = $db->getResult();
     return array('nombre_completo' => $results[0]['nombre_completo'], 'uuid_usuario' => $results[0]['uuid_usuario']);
 }
开发者ID:acampos1916,项目名称:corcione_produccion,代码行数:10,代码来源:Notificaciones.php

示例12: getByEmail

 public function getByEmail($email)
 {
     $db = new Database();
     $db->sql("select s.id,u.Email,u.FirstName,u.LastName,s.Project,s.Location, case when(select GradesPosted from Settings) = 1 then s.Grade else null end as Grade\nfrom Users as u inner join Students as s on u.StudentId = s.id\nwhere u.Email = '" . $email . "'");
     $res = $db->getResult();
     if (count($res) == 0) {
         return null;
     }
     return $res;
 }
开发者ID:M7ammed,项目名称:Mobile-Judge-App,代码行数:10,代码来源:Students.php

示例13: getContact

 public function getContact($email)
 {
     $db = new Database();
     $db->sql('select FirstName, LastName, Email from Users where Email = \'' . $email . '\'');
     $res = $db->getResult();
     $total = 0;
     if (array_key_exists('LastName', $res)) {
         $res = array($res);
         $total = count($res);
     } else {
         $res = $email;
     }
     return array('total' => $total, 'data' => $res);
 }
开发者ID:M7ammed,项目名称:Mobile-Judge-App,代码行数:14,代码来源:Email.php

示例14: setAccept

 public function setAccept($judgeId, $studentId, $acceptance)
 {
     $db = new Database();
     $success = $db->update('JudgeStudentGrade', array('Accepted' => $acceptance ? 1 : 0), 'JudgeId = ' . $judgeId . ' and StudentId = ' . $studentId);
     $msg = $db->getResult();
     if (!$success) {
         return array('success' => false, 'msg' => $msg);
     }
     $db->select('JudgeStudentGrade', 'Grade, Accepted', null, 'StudentId = ' . $studentId);
     $res = $db->getResult();
     if (array_key_exists('Grade', $res)) {
         $res = array($res);
     }
     $grade = 0;
     $reviewed = 0;
     $accepted = 0;
     $total = 0;
     foreach ($res as $judge) {
         $total++;
         if (is_null($judge['Accepted'])) {
             continue;
         }
         if (intval($judge['Accepted']) === 1) {
             $accepted++;
             $grade += intval($judge['Grade']);
         }
         $reviewed++;
     }
     if ($total == $reviewed && $accepted > 0) {
         $grade /= $accepted;
         $db->update('Students', array('Grade' => $grade), 'id = ' . $studentId);
         return array('success' => true, 'grade' => $grade);
     } else {
         $db->sql('UPDATE Students SET Grade = NULL WHERE id = ' . $studentId . ';');
         return array('success' => true, 'grade' => null);
     }
 }
开发者ID:M7ammed,项目名称:Mobile-Judge-App,代码行数:37,代码来源:PendingGrades.php

示例15: get_question_details

 public function get_question_details($qid)
 {
     $result = array();
     $db = new Database();
     if ($db->connect()) {
         if ($db->select('questions', 'q_id,c_id,q_name,q_tag,q_hint,q_points', NULL, 'q_id=' . $qid)) {
             $dbResult = $db->getResult();
             foreach ($dbResult as $out) {
                 $q = new question();
                 $q->set_question_information($out['q_id'], $out['c_id'], $out['q_name'], $out['q_tag'], $out['q_hint'], $out['q_points']);
                 array_push($result, $q);
             }
         }
         $db->disconnect();
     }
     return $result;
 }
开发者ID:shsirk,项目名称:htf,代码行数:17,代码来源:puzzle.php


注:本文中的Database::getResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。