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


PHP DBConnection::select方法代码示例

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


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

示例1: fetchAll

 static function fetchAll()
 {
     DBConnection::connect();
     $result = DBConnection::select('SELECT * FROM post');
     $posts = [];
     if ($result) {
         foreach ($result as $post) {
             array_push($posts, new Post($post->id, $post->title, false));
         }
     }
     return $posts;
 }
开发者ID:jekt,项目名称:blog-php,代码行数:12,代码来源:Post.php

示例2: fetchAll

 static function fetchAll()
 {
     DBConnection::connect();
     $result = DBConnection::select('SELECT * FROM user');
     $users = [];
     if ($result) {
         foreach ($result as $user) {
             array_push($users, new User($user->id, $user->pseudo, false));
         }
     }
     return $users;
 }
开发者ID:jekt,项目名称:blog-php,代码行数:12,代码来源:User.php

示例3: getDataFromDBWithHosLog

 public function getDataFromDBWithHosLog($HosLog)
 {
     $data = DBConnection::select("Select * from hospede WHERE HosLog='" . $HosLog . "'");
     foreach ($data as $row) {
         $this->nome = $row['HosNom'];
         $this->login = $row['HosLog'];
         $this->senha = $row['HosPas'];
         $this->email = $row['HosEma'];
         $this->endereco = $row['HosEnd'];
         $this->cidade = $row['HosCid'];
         $this->pais = $row['HosPai'];
         $this->telefone = $row['HosTel'];
         $this->documento = $row['HosDoc'];
     }
 }
开发者ID:misticsz,项目名称:HotelResbeweard-,代码行数:15,代码来源:Class.php

示例4: ReservaData

<?php 
/**
 * Created by PhpStorm.
 * User: GabrielAguiar
 * Date: 24/05/14
 * Time: 14:51
 */
$arriveDate = $_POST['postarrive'];
$avaliable = false;
$leaveDate = $_POST['postleave'];
$number = $_POST['postnumber'];
$data = DBConnection::select("SELECT * FROM reserva WHERE ResArr between '" . $arriveDate . "' and '" . $leaveDate . "'");
$i = 0;
$newRes = new ReservaData();
$newRes->maxSingle -= $number;
$newRes->maxCouple -= $number / 2;
$newRes->maxLux -= $number;
foreach ($data as $row) {
    if ($row['ResTip'] == 1) {
        $newRes->maxSingle--;
    }
    if ($row['ResTip'] == 2) {
        $newRes->maxCouple--;
    }
    if ($row['ResTip'] == 3) {
        $newRes->maxLux--;
    }
}
echo "<div style='color:white; width:91%; margin-top:10px; float:left;'class='gallery items-3'>";
if ($newRes->maxSingle > 0) {
开发者ID:misticsz,项目名称:HotelResbeweard-,代码行数:30,代码来源:verifyReserva.php

示例5:

<?php 
$login = $_POST['postlogin'];
$pass = $_POST['postpass'];
$tuts = 0;
echo "<script>alert('HI')</script>";
$data = DBConnection::select("SELECT * FROM hospede");
foreach ($data as $row) {
    if ($row['HosLog'] == $login && $row['HosPas'] == $pass) {
        session_start();
        $_SESSION['username'] = $row['HosLog'];
        $_SESSION['password'] = $row['HosPas'];
        $_SESSION['adm'] = $row['HosAdm'];
        $_SESSION['wrongLogin'] = false;
        $tuts = 1;
    }
}
if (!$tuts) {
    session_start();
    $_SESSION['wrongLogin'] = true;
}
开发者ID:misticsz,项目名称:HotelResbeweard-,代码行数:20,代码来源:verifyLogin.php

示例6: DBConnection

<?php

require_once '../model/DBConnection.php';
$db = new DBConnection();
/*
 * INSERT TEST.
 */
$lastInsertedId = $db->insert('truck', array('vehicle_capacity' => 0, 'brand' => 'Scania', 'age' => 4));
echo '<p> Last Inserted ID: ' . $lastInsertedId . '</p>';
/*
 * SELECT SINGLE TEST.
 */
echo '<p> All columns: ';
var_dump($db->select('truck', '*', 'id', $lastInsertedId));
echo '</p>';
echo '<p> Some columns: ';
var_dump($db->select('truck', array('brand', 'age'), 'id', $lastInsertedId));
echo '</p>';
/*
 * SELECT ALL TEST.
 */
$db->insert('truck', array('brand' => 'Mercedes', 'age' => 3));
echo '<p> All rows and columns: ';
var_dump($db->select('truck', '*'));
/*
 * UPDATE TEST.
 */
echo '<p> Before update: ';
var_dump($db->select('truck', '*', 'id', $lastInsertedId));
echo '</p>';
$db->update('truck', array('vehicle_capacity' => 0, 'brand' => 'MAN', 'age' => 0), $lastInsertedId);
开发者ID:stoykovnet,项目名称:SmoothTransport,代码行数:31,代码来源:DBConnection.php

示例7: hospede

			});
	}

</script>

<?php 
$login = $_POST['postlogin'];
$name = $_POST['postname'];
$password = $_POST['postpass'];
$email = $_POST['postemail'];
$endereco = $_POST['postendereco'];
$cidade = $_POST['postcidade'];
$telefone = $_POST['posttelefone'];
$documento = $_POST['postdocumento'];
$pais = $_POST['postpais'];
$loginStats = false;
$emailStats = false;
$data = DBConnection::select("Select * from hospede");
foreach ($data as $row) {
    if ($row['HonLog'] == $login) {
        $loginStats = true;
    }
    if ($row['HonEma'] == $email) {
        $loginStats = true;
    }
}
if ($loginStats) {
    echo "<script>signUp2()</script>";
} else {
    DBConnection::insert('Insert INTO hospede (HosNom,HosLog,HosPas,HosEma,HosEnd,HosCid,HosTel,HosDoc,HosPai) values("' . $name . '","' . $login . '","' . $password . '","' . $email . '","' . $endereco . '","' . $cidade . '","' . $telefone . '","' . $documento . '","' . $pais . '")');
}
开发者ID:misticsz,项目名称:HotelResbeweard-,代码行数:31,代码来源:confirmCadastro.php

示例8: count

 /**
  * Count how many instances of this type reside in the database. If WHERE
  * condition is provided, only instances that correspond with the condition
  * will be counted.
  * @param string|array(string) $where Optional.
  * @param string|array(string) $value Optional.
  * @return int
  */
 public function count($where = null, $value = null)
 {
     $db = new DBConnection();
     $data = null;
     if ($where && $value) {
         $data = $db->select($this->convert_to_table_name($this->get_class_name()), 'COUNT(id)', $where, $value);
     } else {
         $data = $db->select($this->convert_to_table_name($this->get_class_name()), 'COUNT(id)');
     }
     return intval($data[0]['COUNT(id)']);
 }
开发者ID:stoykovnet,项目名称:SmoothTransport,代码行数:19,代码来源:ModelTemplate.php


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