本文整理汇总了PHP中db_get函数的典型用法代码示例。如果您正苦于以下问题:PHP db_get函数的具体用法?PHP db_get怎么用?PHP db_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
static function get($params)
{
$params2 = array();
if (is_string($params)) {
$params = parse_str($params, $params2);
$params = $params2;
}
if (isset($params['content_id'])) {
$params['rel_type'] = 'content';
$params['rel_id'] = mw()->database_manager->escape_string($params['content_id']);
}
$table = MODULE_DB_COMMENTS;
$params['table'] = $table;
$comments = db_get($params);
if (is_array($comments)) {
$i = 0;
foreach ($comments as $item) {
if (isset($item['created_by']) and intval($item['created_by']) > 0 and ($item['comment_name'] == false or $item['comment_name'] == '')) {
$comments[$i]['comment_name'] = user_name($item['created_by']);
}
$i++;
}
}
return $comments;
}
示例2: get_quotes
function get_quotes($params = array())
{
if (is_string($params)) {
$params = parse_params($params);
}
$params['table'] = "ez_quotes";
return db_get($params);
}
示例3: LoadRoles
public function LoadRoles()
{
$rs = db_get()->Execute('system_user_loadroles', $this->__get['Id']);
while ($row = $rs->Fetch()) {
$this->__get['Roles'][$row['RoleId']] = $row['Name'];
}
unset($rs, $row);
return true;
}
示例4: execute
public function execute($fetchas = "")
{
if ($fetchas != "") {
$this->fetchas = $fetchas;
}
if (!isset($this->query) || $this->query == "") {
$this->query = $this->build_query();
}
$res = db_get($this->query, $this->fetchas);
return $res;
}
示例5: db_get_template
function db_get_template($tpl_name, &$tpl_source, &$smarty_obj)
{
global $db;
global $thulit;
$set = db_get("select id from data where name_id='" . $tpl_name . "' and node_type='template'");
if ($arr = $set->fetchRow()) {
$tpl_source = get_value($arr['id'], $thulit['lang']);
return true;
} else {
return false;
}
}
示例6: __construct
function __construct($class_name = NULL)
{
if ($class_name == NULL) {
$this->new_class = true;
} else {
$this->new_class = false;
//conn to database
$db_vals = db_get("Classes", "*", "class_name", sprintf("%s", $class_name));
$this->class_name = $class_name;
$this->subject = $db_vals['subject'];
}
}
示例7: get
function get($id)
{
$id = alphaID($id, true);
if (false !== ($paste = db_get($id))) {
// check to see if this paste has expired
$expired = $this->has_expired($paste);
if ($expired === false) {
return $paste;
}
return $expired;
}
return NCRYPT_DOES_NOT_EXIST;
}
示例8: login
public function login($username, $password)
{
if (value_exists("Registered_User", "username", $username)) {
$db_val = db_get("Registered_User", "password", "username", $username);
if (strcmp($password, $db_val['password']) == 0) {
$role = $this->admin ? "admin" : "registered_user";
return $role;
} else {
return null;
}
} else {
return null;
}
}
示例9: pl_unsubscribe
function pl_unsubscribe()
{
$p = sanitize(['email' => STR, 'groupid' => INT]);
$who = $p['email'];
$what = $p['groupid'];
if (empty($who) || empty($what)) {
return fails('empty input');
}
$db = db_connect();
// test for existence
$res = db_get('select * from subscriptions where email="' . $who . '" and groupid="' . $what . '"');
if (count($res) > 0) {
$db->exec('delete from subscriptions where email="' . $who . '" and groupid="' . $what . '"');
return passes('removed ' . count($res) . ' entries');
}
return fails('nothing found');
}
示例10: dbGet
public function dbGet($params = array())
{
if (empty($params) && $this->id > 0) {
$params = array("id" => $this->id);
}
if (empty($params)) {
return false;
}
$query = "SELECT " . implode(",", $this->params) . " FROM " . $this->schema . $this->table . " WHERE ";
foreach ($params as $key => $val) {
$query .= $key . "=" . dbize($val);
}
$dbvals = db_get($query, "row");
if ($dbvals != NULL) {
$this->setFromArray($dbvals[0]);
}
$this->afterDbGet();
}
示例11: build_query
public function build_query()
{
// Check for existing table
$tab = db_get("SELECT 1 FROM " . $this->table);
if ($tab == NULL || !isset($tab[1])) {
//echo "TABLE does not exist, continue";
} else {
if ($this->debug) {
echo $this->table . " already exists";
}
return false;
}
if (!empty($this->columns)) {
$colstring = "";
$primaryKeyAdded = false;
// Add the column names & types to the query string
foreach ($this->columns as $name => $type) {
if ($colstring != "") {
$colstring .= ",";
}
// If this is the primary key field, add the constraints
if ($this->primaryKeyField != "" && strtolower($name) == strtolower($this->primaryKeyField)) {
$colstring .= primary_key_clause($name);
$primaryKeyAdded = true;
} else {
$colstring .= $name . " " . $type;
}
}
// Add primary key field, if one is set and it wasn't in the column list
if ($this->primaryKeyField != "" && !$primaryKeyAdded) {
$colstring = primary_key_clause($this->primaryKeyField) . ", " . $colstring;
}
if (!empty($this->unique_constraints)) {
foreach ($this->unique_constraints as $constriant_name => $fields) {
$colstring .= ", CONSTRAINT " . $constraint_name . " UNIQUE (" . implode(",", $fields) . ")";
}
}
// Create the query
$query = "CREATE TABLE " . $this->table_with_schema() . "(" . $colstring . ")";
$this->query = $query;
return $this->query;
}
return "";
}
示例12: save
function save($data)
{
if (is_admin() == false) {
error('Must be admin');
}
if (isset($data['shipping_country'])) {
if ($data['shipping_country'] == 'none') {
error('Please choose country');
}
if (isset($data['id']) and intval($data['id']) > 0) {
} else {
$check = db_get('shipping_country=' . $data['shipping_country']);
if ($check != false and is_array($check[0]) and isset($check[0]['id'])) {
$data['id'] = $check[0]['id'];
}
}
}
$data = mw()->database_manager->save($this->table, $data);
return $data;
}
示例13: testSaveCustomFields
public function testSaveCustomFields()
{
$my_product_id = 3;
$custom_field = array('field_name' => 'My test price', 'field_value' => 10, 'field_type' => 'price', 'content_id' => $my_product_id);
// adding a custom field "price" to product
$new_id = save_custom_field($custom_field);
$are_values_here = db_get('table=custom_fields_values&custom_field_id=' . $new_id);
$field = get_custom_field_by_id($new_id);
$to_delete = array('id' => $new_id);
$delete = delete_custom_field($to_delete);
$field2 = get_custom_field_by_id($new_id);
//check if values are deleted
$are_values_gone = db_get('table=custom_fields_values&custom_field_id=' . $new_id);
$this->assertEquals($field['name'], 'My test price');
$this->assertEquals($field['value'], 10);
$this->assertEquals(intval($new_id) > 0, true);
$this->assertEquals(intval($delete) > 0, true);
$this->assertEquals($field2, false);
$this->assertEquals(is_array($are_values_here), true);
$this->assertEquals(is_array($are_values_gone), false);
}
示例14: debug_backtrace
<?php
debug_backtrace() || die("Direct access not permitted.");
?>
<?php
$pdo = db_connect();
$rows = db_get('scl_students');
$plug_path = plugin_path('school_management_vor');
require 'imageResize.php';
$db_ids = array();
foreach ($rows as $row) {
$db_ids[] = $row['image'];
}
$accs = db_get('vor_admin');
$db_accs = array();
foreach ($accs as $acc) {
$db_accs[] = $acc['image'];
}
$image_id_dir = $plug_path . 'images/scl_students/';
$image_acc_dir = 'img/admin/';
$stored_id_images = glob($image_id_dir . '*.jpg');
$stored_acc_images = glob($image_acc_dir . '*.jpg');
$def_image = array_search('img/admin/default_image.png', $stored_acc_images);
unset($stored_acc_images[$def_image]);
if (!empty($stored_id_images)) {
$stored_image_m = array();
foreach ($stored_id_images as $stored_image) {
$stored_image_m[] = basename($stored_image);
}
foreach ($stored_image_m as $stored_image_h) {
示例15: display_site
function display_site($site, $parent = null)
{
global $db;
global $thulit;
if (!isset($site)) {
die("??? \$site nie je definovane ???");
}
$set = db_get("select * from data where name_id='" . $site . "' and node_type='site'");
if ($arr = $set->fetchRow()) {
display($arr, $parent);
}
}