本文整理汇总了PHP中DataBase类的典型用法代码示例。如果您正苦于以下问题:PHP DataBase类的具体用法?PHP DataBase怎么用?PHP DataBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get
public function get($id)
{
require_once 'DataBase.php';
$data = new DataBase();
$data->open();
$sql = "BEGIN GETRUTACONDUCTOR(:p_id, :rc); END;";
$sent = oci_parse($data->getConn(), $sql);
$refcur = oci_new_cursor($data->getConn());
$this->id = $id;
oci_bind_by_name($sent, ':p_id', $this->id);
oci_bind_by_name($sent, ':rc', $refcur, -1, OCI_B_CURSOR);
if (!oci_execute($sent)) {
return false;
}
if (!oci_execute($refcur)) {
return false;
}
while (($row = oci_fetch_array($refcur, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
$this->ruta = $row['ID_RUTA'];
$this->conductor = $row['ID_CONDUCTOR'];
$this->kilometraje = $row['KILOMETRAJE'];
$this->descripcion = $row['DESCRIPCION'];
}
oci_free_statement($refcur);
$data->free($sent);
$data->close();
return true;
}
开发者ID:CEMZ,项目名称:Privado,代码行数:28,代码来源:RutaConductor.php
示例2: loadAtendente
function loadAtendente()
{
include_once 'app.ado/DataBase.php';
$db = new DataBase();
$aten = $db->getConn()->query('select nome_usuario from usuarios where id_usuario = ' . $this->usuario_id . ';')->fetchAll(PDO::FETCH_CLASS, "Item");
return $aten;
}
开发者ID:laiello,项目名称:almoxarifadocedup,代码行数:7,代码来源:Emp.class.php
示例3: render
public function render()
{
if (!$this->conteudo) {
include_once 'app.ado/DataBase.php';
$pdo = new DataBase();
$db = $pdo->getConn();
$sql = 'select * from ctrl_chaves';
if ($this->dt_inicial or $this->dt_final) {
$this->dt_inicial = $this->dt_inicial ? $this->dt_inicial : '2012/01/01';
$this->dt_final = $this->dt_final ? $this->dt_final : date('Y/m/d');
$sql .= ' where ((dt_inicial_controle between ? and ?) or (dt_final_controle between ? and ?))';
$exec[] = $this->dt_inicial;
$exec[] = $this->dt_final;
if ($this->id) {
$sql .= ' and id_controle = ?';
$exec[] = $this->id;
}
} elseif ($this->id) {
$sql .= ' where id_controle = ?';
$exec[] = $this->id;
}
if ($this->order) {
$sql .= ' order by ?';
$exec[] = $this->order;
}
$sth = $db->prepare($sql);
$conteudo = $sth->execute($exec);
$this->conteudo = $conteudo->fetchAll(PDO::FETCH_CLASS, 'CrlChave');
}
$tabela = new TTableChave($this->conteudo);
$pdf = new TRelatorio();
$pdf->writeHTML($tabela->render());
$pdf->render();
$pdf->exit();
}
开发者ID:laiello,项目名称:almoxarifadocedup,代码行数:35,代码来源:TRelChave.class.php
示例4: getTable
function getTable($news_id, $hotelType, $hotelLocation, $impactType)
{
$mydatabase = new DataBase();
//$news = $mydatabase->getNews_by_game($game,$period);
$news = $mydatabase->getNews_by_id($news_id);
//print_r("Game: ".$game.", Period: ".$period);
if (!isset($news) || count($news) == 0) {
return "fail";
}
$parameters = $mydatabase->getAllNews_parameters($news['id']);
$count = 0;
$result = '<h3 align="center"> News Affects Parameters</h3>' . '<br />' . '<table class="table table-bordered">
<thead>
<tr>
<th>#</th>
<th>Hotel Type</th>
<th>Hotel Location</th>
<th>Impact</th>
</tr>
</thead>';
if (isset($parameters) && count($parameters) > 0) {
foreach ($parameters as $key => $temp) {
$result .= "<tbody>" . "<tr>" . "<td>" . ++$count . "</td>" . "<td>" . $temp['hotel_type'] . "</td>" . "<td>" . $mydatabase->getLocation($temp['hotel_location'])['type'] . "</td>" . "<td>" . $temp['effect'] . "</td>" . "</tr>" . "</tbody>";
}
}
if (isset($hotelType) && isset($hotelLocation) && isset($impactType)) {
for ($counter = 0; $counter < count($impactType); $counter++) {
$result .= "<tbody>" . "<tr>" . "<td>" . ($counter + 1 + $count) . "</td>" . "<td>" . $hotelType[$counter] . "</td>" . "<td>" . $hotelLocation[$counter] . "</td>" . "<td>" . $impactType[$counter] . "</td>" . "</tr>" . "</tbody>";
}
}
$result .= "</table><br />";
return $result;
}
开发者ID:jandr018,项目名称:StragicMarketingSimulator,代码行数:33,代码来源:NewsController.php
示例5: search_matrix
public function search_matrix($idMatrix = FALSE)
{
$objData = new DataBase();
$sth = $objData->prepare('SELECT * FROM matrix M inner join users U ' . 'on M.id_matrix = U.id_matrix WHERE M.id_matrix = :idMatrix');
$sth->execute(array(':idMatrix' => $idMatrix));
return $result = $sth->fetchAll();
}
开发者ID:dareyesm,项目名称:paginadorPHP,代码行数:7,代码来源:matrix.php
示例6: PollMessage
function PollMessage()
{
include 'config/config.php';
require_once 'libs/database.php';
$db = new DataBase($db_server, $db_user, $db_password);
$db->Select($db_name);
$db->Query("SELECT * FROM messages ORDER BY id DESC LIMIT 2");
$data = $db->ReadNext();
//no message in queue - return nop
if ($data == null) {
echo "none";
return;
}
/* echo "<pre>";
print_r($data);
echo "</pre>";*/
$id = $data['id'];
$message = $data['message'];
//return the command to client
echo $message;
//delete message from queue
$db = new DataBase($db_server, $db_user, $db_password);
$db->Select($db_name);
$db->Query("DELETE FROM messages WHERE id = '{$id}';");
}
开发者ID:kybernetyk,项目名称:Tune-Buddy,代码行数:25,代码来源:poll_message.php
示例7: listaUnidades
public static function listaUnidades($sql)
{
$db = new DataBase();
$db->setQuery(" \n SELECT\n codUnidad\n , nombre\n FROM e_unidad\n WHERE {$sql}\n AND estado=2\n ");
//f::message($db->getQuery());
$db->executeQuery();
return $db->getTable('encode');
}
开发者ID:eddyn73,项目名称:SURP,代码行数:8,代码来源:DAO_Unidad.php
示例8: loadLaboratorio
function loadLaboratorio()
{
include_once 'app.ado/DataBase.php';
$db = new DataBase();
$lab = $db->getConn()->query('select nome_laboratorio from laboratorios where id_laboratorio = ' . $this->laboratorio_id . ';')->fetch(PDO::FETCH_COLUMN);
unset($db);
return $lab;
}
开发者ID:laiello,项目名称:almoxarifadocedup,代码行数:8,代码来源:CrlChave.class.php
示例9: tearDown
function tearDown()
{
$db = new DataBase();
$db->Clear();
$db->Close();
unset($_SESSION['user']);
unset($_SESSION['pw']);
}
开发者ID:nomeata,项目名称:L-seed,代码行数:8,代码来源:BuisnessLogicTest.php
示例10: getCurrentUser
public static function getCurrentUser($id)
{
$class = static::class;
$sql = 'SELECT * FROM users WHERE id=:id';
$db = new DataBase();
$res = $db->findOne($class, $sql, [':id' => $id]);
return $res;
}
开发者ID:semho,项目名称:customer-DB,代码行数:8,代码来源:App.php
示例11: EnqueueMessage
function EnqueueMessage($message)
{
include 'config/config.php';
require_once 'libs/database.php';
$db = new DataBase($db_server, $db_user, $db_password);
$db->Select($db_name);
$query = "INSERT INTO messages (\n\t\t\t\t\tmessage\n\t\t\t\t\t)\n\t\t\t\t\tVALUES (\n\t\t\t\t\t'{$message}'\n\t\t\t\t\t);";
$db->Query($query);
}
开发者ID:kybernetyk,项目名称:Tune-Buddy,代码行数:9,代码来源:index.php
示例12: get_feed_items
public function get_feed_items()
{
$db = new DataBase();
$result = $db->get_all();
$feed = array();
foreach ($result as $feed_item) {
array_push($feed, new FeedItem($feed_item));
}
return $feed;
}
开发者ID:megazalrock,项目名称:nhkrss,代码行数:10,代码来源:feed.php
示例13: get_siteInfo
function get_siteInfo($TcName)
{
// Busca en la tabla de configuraciones el valor establecido
$query = "SELECT valor,tipo FROM Configuracion WHERE idConfiguracion = '{$TcName}'";
include_once './dataBaseClass/connection.php';
$cDb = new DataBase();
$result = $cDb->query($query);
$row = mysqli_fetch_assoc($result);
return $row["valor"];
}
开发者ID:ggarzam88,项目名称:CobranzaWeb,代码行数:10,代码来源:Funciones.php
示例14: insertNews
public function insertNews() {
$db = new DataBase();
//$db->setClassName(get_called_class());
$news = [];
foreach ($this->data['news'] as $key => $value) {
$news[] = '(' . $key . ', ' . $value . ')';
}
$sql = 'INSERT INTO ' . $this->table . '(Owner, Post) VALUES ' . implode(', ', array_values($news)) . ' ON DUPLICATE KEY UPDATE Owner = Owner';
return $db->execute($sql);
}
开发者ID:Narrator69,项目名称:why-not,代码行数:10,代码来源:class_engine.php
示例15: get_dataByLogin
function get_dataByLogin($login)
{
$db = new DataBase();
$mysqli = $db->getMysqli();
$sql = 'SELECT * FROM users WHERE login ="' . $login . '"';
if ($result = $mysqli->query($sql)) {
return $result->fetch_assoc();
} else {
return null;
}
}
开发者ID:nakiden,项目名称:quicksilk,代码行数:11,代码来源:model_login.php
示例16: delete
public function delete($profesional)
{
try {
$database = new DataBase();
$mdb = $database->connect();
$query = $mdb->prepare('DELETE FROM profesionales WHERE matricula = ?');
$query->bindParam(1, $profesional->matricula);
return $query->execute();
} catch (PDOException $e) {
$e->getMessage();
}
}
开发者ID:PYSW,项目名称:TP_Final,代码行数:12,代码来源:ProfesionalPDO.php
示例17: delete
public function delete($noticia)
{
try {
$database = new DataBase();
$mdb = $database->connect();
$query = $mdb->prepare('DELETE FROM noticias WHERE idnoticia = ?');
$query->bindParam(1, $noticia->idNoticia);
return $query->execute();
} catch (PDOException $e) {
$e->getMessage();
}
}
开发者ID:PYSW,项目名称:TP_Final,代码行数:12,代码来源:NoticiasPDO.php
示例18: getPatternByProgram
static function getPatternByProgram($program)
{
$pattern = new Pattern();
$db = new DataBase("SchedulerDatabase");
$getProgramPattern = "SELECT * FROM Patterns \n\t\t\t\t\t\t\t\t\tWHERE ProgramID = '{$program}'\n\t\t\t\t\t\t\t\t\tORDER BY YearRequired, TermRequired, SubjectID;";
$rows = $db->execute($getProgramPattern);
while ($row = $rows->fetch_object()) {
$newItem = new PatternItem($row->ProgramID, $row->CourseType, $row->YearRequired, $row->TermRequired, $row->SubjectID, $row->CourseNumber);
$pattern->addItem($newItem);
}
return $pattern;
}
开发者ID:charberg,项目名称:CSA,代码行数:12,代码来源:pattern.php
示例19: get_conn
/**
* 取得一个AdoDB的数据库连接对象
*/
function get_conn($dbhost = '', $dbname = '', $dbuser = '', $dbpsw = '', $charset = '')
{
require_once EZBOSS_CLASSES_PATH . DIRECTORY_SEPARATOR . 'DataBase.class.php';
if ($dbhost == '') {
global $dbhost, $dbname, $dbuser, $dbpsw, $charset;
}
$db = new DataBase($dbhost, $dbname, $dbuser, $dbpsw, $charset);
try {
$conn = $db->getConn();
return $conn;
} catch (Exception $e) {
echo "数据库连接失败";
exit;
}
}
开发者ID:BGCX067,项目名称:ezboss-svn-to-git,代码行数:18,代码来源:common.func.php
示例20: updateRow
public function updateRow()
{
$cols = [];
$data = [];
$db = new DataBase();
foreach ($this->data as $k => $v) {
$data[':' . $k] = $v;
if ('id' == $k) {
continue;
}
$cols[] = $k . '=:' . $k;
}
$sql = ' UPDATE ' . static::$table . ' SET ' . implode(', ', $cols) . ' WHERE id=:id';
return $db->execute($sql, $data);
}
开发者ID:TTcuXOgaJI,项目名称:Test,代码行数:15,代码来源:AbstractModel.php
注:本文中的DataBase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论