本文整理汇总了PHP中db_get_all函数的典型用法代码示例。如果您正苦于以下问题:PHP db_get_all函数的具体用法?PHP db_get_all怎么用?PHP db_get_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_get_all函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: paginate
public function paginate($page, $per_page = 20, $where = '')
{
//$page = abs($page) - 1;
$skip = ($page - 1) * $per_page;
$sql = "SELECT * FROM `{$this->table}` {$where} LIMIT {$per_page} OFFSET {$skip}";
return db_get_all($sql);
}
示例2: getAllByUserId
public function getAllByUserId($user_id)
{
$first_day_this_month = date("Y-m-d", strtotime('first day of this month'));
$first_day_next_month = date("Y-m-d", strtotime('first day of next month'));
$sql = "SELECT * FROM `{$this->table}`\n WHERE `user_id` = " . intval($user_id) . "\n AND `paid_day` >= '" . $first_day_this_month . "'\n AND `paid_day` < '" . $first_day_next_month . "'";
return db_get_all($sql);
}
示例3: execute
function execute($requests)
{
$u = $GLOBALS['AUTH']->uid();
$sessid = session_id();
$sql = 'SELECT c_member_id, nickname FROM c_member WHERE c_member_id <> ?';
$params = array($u);
$members = db_get_all($sql, $params);
$sql = 'SELECT c_member_id, nickname FROM c_member WHERE c_member_id = ?';
$params = array($u);
$my_info = db_get_row($sql, $params);
array_unshift($members, $my_info);
$id = $requests['target_id'];
$group = biz_getGroupData($id);
if ($u != $group['admin_id']) {
die('アクセスできません。');
}
foreach ($members as $key => $value) {
if (biz_isGroupMember($value['c_member_id'], $id)) {
$members[$key]['joined'] = true;
} else {
$members[$key]['joined'] = false;
}
}
$this->set('inc_navi', fetch_inc_navi('h'));
$this->set("c_invite_list", $members);
$this->set("group", $group);
$this->set("c_member_id", $u);
return 'success';
}
示例4: getBy
public function getBy($value, $field = null)
{
if ($field === null) {
$field = $this->primary_key;
}
$sql = "SELECT `{$this->table}`.*,`posts`.`Title` FROM `{$this->table}`,`posts` WHERE `{$this->table}`.`{$field}` = " . esc($value) . " and `{$this->table}`.`{$field}`= `posts`.`post_id`";
$rows = db_get_all($sql);
return isset($rows) ? $rows : false;
}
示例5: check_true
public function check_true($value, $field = null)
{
if ($field === null) {
$field = $this->primary_key;
}
$sql = "SELECT * FROM `{$this->table}` WHERE `{$field}` = '" . esc($value) . "' LIMIT 1";
$rows = db_get_all($sql);
return isset($rows[0]) ? true : false;
}
示例6: db_get_one
function db_get_one($sql, $_db = NULL)
{
$result = db_get_all($sql, MDB2_FETCHMODE_ASSOC, $_db);
if (PEAR::isError($result) || count($result) == 0) {
return NULL;
} else {
return $result[0];
}
}
示例7: db_load_config
/**
* c_admin_config から設定値を読み込み
* ひとまず定数として定義
*/
function db_load_config()
{
$sql = 'SELECT * FROM c_admin_config';
$configs = db_get_all($sql);
foreach ($configs as $config) {
if (!$this->is_allowed($config['name'])) {
continue;
}
defined($config['name']) or define($config['name'], $config['value']);
}
}
示例8: getCartList
public function getCartList($cart)
{
$str = "";
foreach ($cart as $c) {
if ($c['book_id'] == end($cart)['book_id']) {
$str .= $c['book_id'];
} else {
$str .= $c['book_id'] . ',';
}
}
$sql = "SELECT id, name, image, price FROM books where id in (" . $str . ")";
return db_get_all($sql);
}
示例9: db_rss_list_c_rss_cache_list_date
function db_rss_list_c_rss_cache_list_date($c_member_id, $year, $month, $day = 0)
{
if ($day) {
$s_date = date('Y-m-d H:i:s', mktime(0, 0, 0, $month, $day, $year));
$e_date = date('Y-m-d H:i:s', mktime(0, 0, 0, $month, $day + 1, $year));
} else {
$s_date = date('Y-m-d H:i:s', mktime(0, 0, 0, $month, 1, $year));
$e_date = date('Y-m-d H:i:s', mktime(0, 0, 0, $month + 1, 1, $year));
}
$sql = 'SELECT * FROM c_rss_cache WHERE c_member_id = ?' . ' AND r_datetime >= ? AND r_datetime < ?' . ' ORDER BY r_datetime DESC';
$params = array(intval($c_member_id), $s_date, $e_date);
$lst = db_get_all($sql, $params);
foreach ($lst as $key => $value) {
$lst[$key]['c_member'] = db_member_c_member4c_member_id($value['c_member_id']);
}
return $lst;
}
示例10: execute
function execute($requests)
{
$u = $GLOBALS['AUTH']->uid();
$sessid = session_id();
$sql = 'SELECT c_member_id, nickname FROM c_member WHERE c_member_id <> ?';
$params = array(intval($u));
$members = db_get_all($sql, $params);
$sql = 'SELECT c_member_id, nickname FROM c_member WHERE c_member_id = ?';
$params = array(intval($u));
$my_info = db_get_row($sql, $params);
array_unshift($members, $my_info);
$this->set('inc_navi', fetch_inc_navi('h'));
$this->set("c_invite_list", $members);
$this->set("c_member_id", $u);
$member_list = unserialize($requests['memberlist']);
$this->set("name", $requests['name']);
$this->set("info", $requests['info']);
$this->set("member_list", $member_list);
return 'success';
}
示例11: get_comment_data
function get_comment_data($input, $id)
{
//日記の場合
if ($input['data_type'] < 2) {
$sql = 'SELECT c_diary_comment_id as id,c_member_id as uid,body as comment,r_datetime as date ' . ' FROM c_diary_comment' . ' WHERE c_diary_id = ?' . ' ORDER BY c_diary_comment_id';
//トピック/イベントの場合
} else {
$sql = 'SELECT c_commu_topic_comment_id as id,c_member_id as uid,body as comment,r_datetime as date ' . ' FROM c_commu_topic_comment' . ' WHERE c_commu_topic_id = ? AND number > 0 ' . ' ORDER BY c_commu_topic_comment_id';
}
$params = array(intval($id));
$data = db_get_all($sql, $params);
return $data;
}
示例12: getBillDetails
public function getBillDetails($bill_id)
{
$sql = "SELECT * FROM bill_details WHERE bill_id=" . $bill_id;
return db_get_all($sql);
}
示例13: get_image_size
/**
* 登録済み画像のファイルサイズを求める
*/
function get_image_size($category, $params, $handle)
{
// request
$table = $params[0];
$filename = $params[1];
$c_member_id = $params[2];
// c_image 参照先
$image_dsn = array('main', 'image');
foreach ($image_dsn as $key => $dsn) {
if (!isset($GLOBALS['_OPENPNE_DSN_LIST'][$dsn])) {
continue;
}
$imagedb =& db_get_instance($dsn);
// 取り出し
$sql = 'SELECT ';
if ($table != 'biz_shisetsu') {
$sql .= $c_member_id . ' as c_member_id, ';
}
$sql .= $filename . ' as image_filename ';
if ($table == 'c_member') {
$sql .= ',r_date ';
} elseif ($table != 'biz_group' && $table != 'biz_shisetsu') {
$sql .= ',r_datetime ';
}
$sql .= 'FROM ' . $table;
$sql .= ' WHERE ' . $filename . ' <> ""';
$sql .= ' AND ' . $filename . ' is not NULL';
$data_list = db_get_all($sql);
$lines = 0;
if ($data_list) {
fwrite($handle, 'INSERT INTO c_image_size VALUES');
}
foreach ($data_list as $data) {
// get image size
$sql = 'SELECT bin FROM c_image WHERE filename = ?';
$params = array($data['image_filename']);
$c_image_list = $imagedb->get_all($sql, $params);
foreach ($c_image_list as $c_image) {
$filesize = strlen(base64_decode($c_image['bin']));
}
$ins_data = '';
if ($lines) {
$ins_data .= ',';
}
$ins_data .= '(';
if ($GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['phptype'] == 'pgsql') {
$ins_data .= " nextval('c_image_size_c_image_size_id_seq')";
} else {
$ins_data .= ' null';
}
$ins_data .= ",'" . $data['image_filename'] . "'";
$ins_data .= ",'" . $data['c_member_id'] . "'";
$ins_data .= ",'" . $filesize . "'";
$ins_data .= ",'" . $category . "'";
if ($table == 'biz_group' || $table == 'biz_shisetsu') {
$ins_data .= ",'" . db_now() . "'";
} elseif ($table == 'c_member') {
$ins_data .= ",'" . $data['r_date'] . "'";
} else {
$ins_data .= ",'" . $data['r_datetime'] . "'";
}
$ins_data .= ')';
fwrite($handle, $ins_data);
$lines++;
}
if ($lines) {
fwrite($handle, ";\n");
}
}
}
示例14: checkUser
public function checkUser($username)
{
$sql = "select * from `{$this->table}` where `user_name`='{$username}'";
return db_get_all($sql);
}
示例15: test_offair_rep_migration
function test_offair_rep_migration()
{
$status = $this->migr->setup('offairrep@example.com');
$this->assertTrue($status == 3);
// Migrate
$status = $this->migr->migrate();
$this->assertTrue($status == 3);
$users = $this->migr->get_users('offairrep@example.com');
$u = $users[1];
$this->assertTrue($u['id'] == 131);
$this->assertTrue($u['institution_id'] == 789);
$this->assertTrue($u['telephone_number'] == '012345');
$this->assertTrue($u['offair_notifications'] == 255);
// Rights are migrated
$this->assertIdentical($this->migr->get_user_rights(131), array('offair_rep'));
// Migration has also changed off-air order IDs
$sql = 'SELECT * FROM Orders';
$orders = db_get_all($sql, DB_FETCHMODE_ASSOC, $this->migr->db);
$this->assertTrue($orders[0]['off_air_rep_id'] == 131);
$this->assertTrue($orders[1]['off_air_rep_id'] == 131);
$this->assertTrue($orders[2]['off_air_rep_id'] == 999);
}