本文整理汇总了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;
}
示例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;
}
}
示例3: remove
public function remove($id)
{
$db = new Database();
$db->delete('Questions', 'id=' . $id);
$res = $db->getResult();
return array('success' => $res[0] === 1);
}
示例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);
}
示例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();
}
示例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;
}
示例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();
}
示例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));
}
示例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);
}
示例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);
}
示例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']);
}
示例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;
}
示例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);
}
示例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);
}
}
示例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;
}