本文整理汇总了PHP中database::select方法的典型用法代码示例。如果您正苦于以下问题:PHP database::select方法的具体用法?PHP database::select怎么用?PHP database::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database
的用法示例。
在下文中一共展示了database::select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adlib
function adlib($id, $type)
{
// create adlib xml basic structure
$XML = new simpleXmlElement("<?xml version='1.0' encoding='utf-8'?><adlibXML xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.adlibsoft.com/adlibXML.xsd' />");
echoall("Start Adlib XML export");
echoall("Connect database");
$daba = new database();
$daba->connect("localhost", "iggmp", "1s87J37r0");
if ($daba->select("thesaurus")) {
echoall("Database connected");
} else {
die("***ERROR - Database connection failed");
}
$termType = thesaurus::get_name($id);
echoall("Starte bei <b>'" . thesaurus::get_name($id) . "'</b>");
//------------------------------------------------------------------------------
// create recordList
xml_insert($XML, new simpleXmlElement("<recordList />"));
// insert records in recordList
$subXml = _subtree($id, $termType);
if ($subXml) {
xml_insert($XML->recordList, $subXml);
}
echoall("XML export completed<hr>");
echoall($XML);
return $XML->asXML();
}
示例2: get
public static function get($variable, $default)
{
$s = database::select("variables", array("variable_value"), "variable_name='%var'", array("%var" => $variable));
if (($b = database::fetch($s, PDO::FETCH_COLUMN)) != null) {
return json_decode($b, true);
} else {
return $default;
}
}
示例3: challenge_login
public static function challenge_login($user, $pass)
{
$result = false;
$query = database::select('id, password')->tables('user')->where('username', '=', ':username')->where('status', '=', 1, 'and')->param(':username', $user)->limit(1)->execute();
$query_result = $query->fetch();
if ($query_result && bcrypt::verify(user::config()->get('salt') . $query_result->uid . $pass, $query_result->pass)) {
$result = (int) $query_result->id;
}
return $result;
}
示例4: get_message_count
public static function get_message_count($game_id)
{
if (safe_input::is_number($game_id)) {
$db = new database();
$db->select("message", "*", "gameID= {$game_id} ");
return $db->number_of_rows();
} else {
return -1;
//invalid game_id
}
}
示例5: __construct
public function __construct($argv)
{
self::$network_time = time();
// network time, sets to self::$network_time until we recieve some info from a main server.
$parser = new parser(CONFPATH . 'services.conf');
// get the config values.
self::$debug = $argv[1] == 'debug' ? true : false;
// is debug mode running? y/n
if (isset(self::$config->nickserv)) {
self::$service_bots[] = 'nickserv';
}
if (isset(self::$config->chanserv)) {
self::$service_bots[] = 'chanserv';
}
if (isset(self::$config->operserv)) {
self::$service_bots[] = 'operserv';
}
// setup our $config->service_bots dir
$this->timer = new timer();
$this->mode = new mode();
$this->services = new services();
$this->commands = new commands();
$this->modules = new modules();
// setup all the subclasses.
database::factory(self::$config->database->driver);
// setup the db.
self::$socket = self::connect();
// connect to the socket
self::protocol_init();
// load the protocol class
$select = database::select('core', array('max_users'), array('id', '=', '1'));
$max_users = database::row($select);
// get the max users
self::$max_users = $max_users[0];
// set a global variable
timer::add(array('core', 'reset_flood_cache', array()), 120, 0);
// add a timer to reset the flood cache every
// 120 seconds, indefinatly
if (self::$config->settings->loglevel != 'off' || !isset(self::$config->settings->loglevel)) {
timer::add(array('core', 'save_logs', array()), 300, 0);
}
// add another timer to save logs every 5 mins
timer::add(array('core', 'check_unused_chans', array()), 5, 0);
// and another one to check for unused channels every 5 seconds XD
if (is_resource(self::$socket)) {
$this->main_loop();
} else {
exit;
}
// execute the main program loop
}
示例6: getGameById
public static function getGameById($game_id)
{
if (safe_input::is_number($game_id)) {
$db = new database();
$db->select("game", "*", "id= {$game_id} ");
if ($db->number_of_rows() > 0) {
return $db->fetch_row();
} else {
return FALSE;
}
} else {
return false;
}
}
示例7: _find_match
public static function _find_match($term, $mode, $limit)
{
$new_term = str_replace('*', '%', $term);
// search for a nickname
// allow the ability to search with "*"'s
$limit = database::quote($limit);
$s_limit = explode('-', $limit);
$offset = $s_limit[0];
$max = $s_limit[1];
// split up the limit and stuff ^_^
if ($mode == 'suspended') {
$results = database::select('users', array('id', 'display', 'last_hostmask', 'suspended', 'suspend_reason'), array('suspended', '=', '1', 'AND', 'display', 'LIKE', $new_term), '', array($offset => $max));
} else {
$results = database::select('users', array('id', 'display', 'last_hostmask', 'suspended', 'suspend_reason'), array('suspended', '=', '0', 'AND', 'display', 'LIKE', $new_term), '', array($offset => $max));
}
return $results;
}
示例8: database
<?php
session_start();
$pid = '';
if (isset($_GET['pid'])) {
$pid = $_GET['pid'];
}
require_once "../../lib/server-config.php";
require_once "../../lib/connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s'", mysql_real_escape_string("registerrecord"), mysql_real_escape_string($pid));
$resultRegister = $db->select($strSQL, false, true);
if (!$resultRegister) {
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Introducing Lollipop, a sweet new take on Android.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SIMANH South Africa</title>
<!-- Page styles -->
<link href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="./css/material.min.css">
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" type="text/css" href="css/style.css" />
示例9: database
<?php
$userdata = $this->_userData;
$has_ads_pin = $userdata['ads_pin'];
if ($has_ads_pin != NULL) {
$ads_pin = $has_ads_pin;
$selectPin = "disabled";
} else {
$ads_pin = "";
$selectPin = NULL;
}
$db = new database(DBTYPE, DBHOST, DBNAME, DBUSER, DBPASS);
$checkPin = $db->select("user_accounts", "acc_type", "agent_id = '{$has_ads_pin}'", "fetch");
if ($checkPin['acc_type'] == 'admin') {
$selectPin = NULL;
}
$accType = $this->accType;
$bankList = $this->bankList;
$paymentMethodList = $this->paymentMethodList;
$accCode = $userdata['acc_type'];
$colSize = $accCode != "pb" ? "col-md-6" : "col-md-12";
$notPB = $accCode != "pb" ? TRUE : FALSE;
?>
<div class="col-xs-12">
<h2 class="page-header">Account Setup</h2>
<?php
include 'menu.php';
?>
<div>
<div class="account-setup tab-content">
示例10: trim
<?php
session_start();
include "./server-config.php";
$strUsername = trim($_POST["data1"]);
$strPassword = trim($_POST["data2"]);
$strPassword = md5($strPassword);
require "connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "useraccount WHERE username = '%s' and password = '%s' and status = '1'", mysql_real_escape_string($strUsername), mysql_real_escape_string($strPassword));
$resultaccount = $db->select($strSQL, false, true);
if ($resultaccount) {
print "Y";
$_SESSION['userSIMANHsession'] = session_id();
$_SESSION['userSIMANHusername'] = $resultaccount[0]['username'];
session_write_close();
} else {
//print $strSQL;
print "N";
}
$db->disconnect();
示例11: get_all_roles
public static function get_all_roles()
{
return database::fetchAll(database::select("groups"));
}
示例12: database
<?php
session_start();
include "./../lib/server-config.php";
require "./../lib/connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
//Check user priviledge
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE username = '%s' and status = 1 and user_type_id = '%s'", mysql_real_escape_string("useraccount"), mysql_real_escape_string($_SESSION['userSIMANHusername']), mysql_real_escape_string(3));
$resultUser = $db->select($strSQL, false, true);
//If privilegde available
if ($resultUser) {
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s \n\t\t\t\tWHERE record_id = '%s'", mysql_real_escape_string("outcome"), mysql_real_escape_string($_SESSION['userSIMANHmother_record']));
$resultSelectOutcome = $db->select($strSQL, false, true);
$no = 1;
if ($resultSelectOutcome) {
$no = sizeof($resultSelectOutcome);
}
$strSQL = sprintf("INSERT INTO " . substr(strtolower($tbf), 0, -2) . "%s \n\t\t\t\tVALUE ('','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s'\n\t\t\t\t,'%s','%s','%s')", mysql_real_escape_string("outcome"), mysql_real_escape_string($_POST['gender']), mysql_real_escape_string($_POST['alive']), mysql_real_escape_string($_POST['stillbirth']), mysql_real_escape_string($_POST['ag5']), mysql_real_escape_string($_POST['ag10']), mysql_real_escape_string($_POST['rbm']), mysql_real_escape_string($_POST['birth_wieght']), mysql_real_escape_string($_POST['hc']), mysql_real_escape_string($_POST['fetal_length']), mysql_real_escape_string($_POST['bdf']), mysql_real_escape_string($_POST['bdf_identify']), mysql_real_escape_string($_POST['bdn']), mysql_real_escape_string($_POST['ebf']), mysql_real_escape_string($_POST['bf']), mysql_real_escape_string($_POST['ff']), mysql_real_escape_string($_POST['skin2skin']), mysql_real_escape_string($_POST['pmctv_lb']), mysql_real_escape_string($_POST['nb_adm']), mysql_real_escape_string($_POST['nb_date_adm']), mysql_real_escape_string($_POST['nb_time_adm']), mysql_real_escape_string($_POST['nb_neonatal']), mysql_real_escape_string($_POST['nb_refer']), mysql_real_escape_string($_POST['nb_refer_facility']), mysql_real_escape_string("nb." . $_SESSION['userSIMANHmother_record'] . "-" . $no), mysql_real_escape_string($_SESSION['userSIMANHmother_record']));
$resultInsert = $db->insert($strSQL, false, true);
if ($resultInsert) {
$strSQL = sprintf("SELECT record_id FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s' ", mysql_real_escape_string("outcome"), mysql_real_escape_string($_SESSION['userSIMANHmother_record']));
$resultCheck = $db->select($strSQL, false, true);
if ($resultCheck) {
$db->disconnect();
?>
<script>
alert('Delivery information complete!');
window.location = '../enter/main.php?id=4';
</script>
<?php
示例13: getMessages
public static function getMessages($cond = NULL, $fetch = "fetchAll")
{
if ($cond != NULL) {
$where = $cond;
} else {
$where = NULL;
}
$db = new database(DBTYPE, DBHOST, DBNAME, DBUSER, DBPASS);
$data = $db->select("user_messages", "*", $where, $fetch);
return $data;
}
示例14: complete
function complete()
{
$userdata = $this->user;
$agent_id = $userdata['agent_id'];
$paymentComplete = TRUE;
$db = new database(DBTYPE, DBHOST, DBNAME, DBUSER, DBPASS);
$hasPayment = user::checkExist("user_payment", "agent_id = '{$agent_id}'");
$paymentDetails = $db->select("user_payment", "payment_date, payment_time, from_acc, to_acc, payment_type", "agent_id = '{$agent_id}'", "fetch");
if ($paymentDetails != FALSE) {
foreach ($paymentDetails as $key => $value) {
if (empty($value)) {
$paymentComplete = FALSE;
}
}
} else {
$paymentComplete = FALSE;
}
if (!$hasPayment or !$paymentComplete) {
redirect::to("setup/payment");
}
$this->breadcrumb->add("Complete", "setup/complete");
$this->view->breadcrumbs = $this->breadcrumb->get();
$this->view->js = array('setup/js/setup.js');
$this->view->render('setup/complete', 'backoffice');
}
示例15: database
<?php
session_start();
include "./../lib/server-config.php";
require "./../lib/connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
$key = $_POST["key"];
//Check user priviledge
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE username = '%s' and status = 1 and user_type_id = '%s'", mysql_real_escape_string("useraccount"), mysql_real_escape_string($_SESSION['userSIMANHusername']), mysql_real_escape_string(3));
$resultUser = $db->select($strSQL, false, true);
if ($resultUser) {
$strSQL = "SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "registerrecord\n\t\t\t\tWHERE (pid like '" . $key . "%' or p_fname like '%" . $key . "%' or p_lname like '%" . $key . "%' or point_no = '%" . $key . "%'\n\t\t\t\t or folder_no = '%" . $key . "%') and confirm_status = '0' and username in (SELECT username FROM " . substr(strtolower($tbf), 0, -2) . "userdescription WHERE institute_id in (SELECT institute_id FROM " . substr(strtolower($tbf), 0, -2) . "userdescription WHERE username = '" . $_SESSION['userSIMANHusername'] . "'))";
$resultSearch = $db->select($strSQL, false, true);
if ($resultSearch) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td height="25" width="40" align="left" style="padding-left:5px; color:#FFF; font-size:0.8em;" bgcolor="#669999"><strong>No
</th>
</strong>
<td align="left" style="padding-left:5px; color:#FFF; font-size:0.8em;" bgcolor="#669999"><strong>Full name
</th>
</strong>
<td align="left" width="120" style="padding-left:5px; color:#FFF; font-size:0.8em;" bgcolor="#669999"><strong>Admission date
</th>
</strong>
<td align="left" width="80" style="padding-left:5px; color:#FFF; font-size:0.8em;" bgcolor="#669999"><strong>Status
</strong>
<td align="left" width="150" style="padding-left:5px; color:#FFF; font-size:0.8em;" bgcolor="#669999"><strong>Labour</strong> </tr>
<?php