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


PHP mydb::query方法代码示例

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


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

示例1: get_my_answers

function get_my_answers($id)
{
    $db = new mydb();
    $query = "select q.id as q_id, q.content, c.choice, c.answer from crystal q, answer a, choices c where a.q_id = q.id and a.answer = c.id and a.m_id = \$1";
    $result = $db->query($query, array($id), "getans");
    return $result;
}
开发者ID:ryucd,项目名称:Shindan,代码行数:7,代码来源:log.php

示例2: update_log

function update_log($m_id, $answer)
{
    $sex = getNewLogSex($m_id, $answer);
    $db = new mydb();
    $query = "insert into log (m_id, sex) values(\$1, \$2)";
    $result = $db->query($query, array($m_id, $sex), "setlog");
}
开发者ID:ryucd,项目名称:Shindan,代码行数:7,代码来源:answer.php

示例3: get_questions_with_search

function get_questions_with_search($search)
{
    $db = new mydb();
    $query = "select c.id, c.date, c.content, m.login_name from crystal c, member m where c.m_id = m.id and c.content like \$1";
    $result = $db->query($query, array("%" . $search . "%"), "search");
    return $result;
}
开发者ID:ryucd,项目名称:Shindan,代码行数:7,代码来源:list.php

示例4: get_choices

function get_choices($id)
{
    $db = new mydb();
    $query = "select * from choices c where c.q_id = \$1";
    $result = $db->query($query, array($id), "choices");
    return $result;
}
开发者ID:ryucd,项目名称:Shindan,代码行数:7,代码来源:diagnosis.php

示例5: getNewLogSex

function getNewLogSex($id, $n)
{
    $db = new mydb();
    $query = "select c.answer from answer a, choices c where a.m_id = \$1 and c.id = a.answer";
    $result = $db->query($query, array($id), "getNewLogSex");
    $num = pg_num_rows($result);
    $sum = 0;
    if ($num == 0) {
        return "1000";
    }
    for ($i = 0; $i < $num; $i++) {
        $row = pg_fetch_assoc($result, $i);
        $sum += intval($row['answer']);
    }
    $sum += $n;
    return $sum / ($num + 1);
}
开发者ID:ryucd,项目名称:Shindan,代码行数:17,代码来源:setting.php

示例6: error

//Fehlerinstanz
$api = php_sapi_name();
$err = new error($api);
include_once "dblib.php";
include_once "pepper.php";
include_once "erplib.php";
$erpdb = new mydb($ERPhost, $ERPdbname, $ERPuser, $ERPpass, $ERPport, 'pgsql', $err, $debug);
$shopdb = new mydb($SHOPhost, $SHOPdbname, $SHOPuser, $SHOPpass, $SHOPport, 'mysql', $err, $debug);
$sql = "SELECT * FROM custom_variable_configs WHERE name = 'pepperkunde'";
$rs = $erpdb->getOne($sql);
if (isset($rs['id'])) {
    $cvarid = $rs['id'];
} else {
    exit;
}
$sql = "SELECT k_ID,Kunden_NR FROM kunde WHERE Kunden_NR != '0'";
$kunden = $shopdb->getAll($sql);
$sqlkdnr = "SELECT id FROM customer WHERE customernumber = '%s' ";
$sqldel = "DELETE FROM custom_variables WHERE config_id={$cvarid} AND trans_id=";
$sqlins = "INSERT INTO custom_variables (config_id,trans_id,text_value) VALUES ({$cvarid},%d,'%s')";
$i = 0;
if ($kunden) {
    foreach ($kunden as $nr) {
        $rs = $erpdb->getOne(sprintf($sqlkdnr, $nr['kunden_nr']));
        if (isset($rs['id'])) {
            echo $nr['k_id'] . " -> " . $nr['kunden_nr'] . "\n";
            $rc = $erpdb->query($sqldel . $rs['id']);
            $rc = $erpdb->query(sprintf($sqlins, $rs['id'], $nr['kunden_nr']));
        }
    }
}
开发者ID:vanloswang,项目名称:kivitendo-crm,代码行数:31,代码来源:mkShop2ERPcvar.php

示例7: getGraphData

function getGraphData()
{
    $db = new mydb();
    $query = "select * from log where m_id = \$1";
    $result = $db->query($query, array($_SESSION['id']), "getGraphData");
    return $result;
}
开发者ID:ryucd,项目名称:Shindan,代码行数:7,代码来源:top.php

示例8: mydb

$db = new mydb();
while ($dataset = fgets($fp, 1024)) {
    $data = explode(',', $dataset);
    preg_match("/^(\\d{4,})(\\d{2,})(\\d{2,})T(\\d{2,})(\\d{2,})(\\d{2,})\\..*/ism", $data[0], $ret);
    if (preg_match('/StartTime/i', $data[0])) {
        continue;
    }
    $day = $ret[1] . '-' . $ret[2] . '-' . $ret[3];
    $date = $day . ' ' . $ret[4] . ':' . $ret[5] . ':' . $ret[6];
    if ($count == 0) {
        $position = $date;
    }
    $watt = $data[2] * 6 * 1000;
    @($usage[$day][$ret[4]]['watt'] += $watt);
    #var_dump(round($watt));
    $db->query("INSERT INTO measure_watt ( sensor, data, time) values( {$argv['1']}, round( {$watt} ), '{$date}' )");
    $count++;
}
$db->query("INSERT INTO measure_positions ( position_time, position_description, position_sensor) values( '{$position}', 'google Power Meter import', '{$argv['1']}' )");
#var_dump($usage);exit;
foreach ($usage as $k => $v) {
    foreach ($v as $vk => $vv) {
        @($daily += $vv[watt]);
        $count_hourly++;
        @($w = number_format(round($vv[watt]), 0, ',', '.'));
        $db->query("INSERT INTO measure_watt_hourly( sensor, data, hour, time) values( '{$argv['1']}', '{$w}', '{$vk}', '{$k}' )");
    }
    $count_daily++;
    $daily = number_format(round($daily), 0, ',', '.');
    $db->query("INSERT INTO measure_watt_daily( sensor, data, time) values( '{$argv['1']}', '{$daily}', '{$k}' )");
}
开发者ID:snazy2000,项目名称:measureit,代码行数:31,代码来源:import_google_powermeter.php

示例9: login_success

<?php

session_start();
include "setting.php";
if (post_check()) {
    $login_name = $_POST['login_name'];
    $pwd = $_POST['pwd'];
} else {
    gotoindex();
}
$db = new mydb();
$query = "select * from member where login_name=\$1";
$result = $db->query($query, array($login_name));
if (pg_num_rows($result) == 1) {
    $row = pg_fetch_assoc($result, 0);
    if (password_verify($pwd, $row['pwd'])) {
        $_SESSION['login_name'] = $row['login_name'];
        $_SESSION['id'] = $row['id'];
        $_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR'];
        login_success();
    } else {
        login_failed();
    }
} else {
    login_failed();
}
function login_success()
{
    header("Location: top.php");
}
function post_check()
开发者ID:ryucd,项目名称:Shindan,代码行数:31,代码来源:login_check.php

示例10: dirname

<?php

include_once dirname(__FILE__) . '/class_mydb.php';
$db = new mydb(array('hostname' => DB_HOST, 'username' => DB_USER, 'password' => DB_PASSWORD, 'database' => DB_NAME));
//get user by ID
$user_info = array();
if (FALSE === ($res = $db->query('SELECT uid, username, dob, mobile, address FROM register_user WHERE uid = ?', array((int) $uid)))) {
    error_log(__METHOD__ . " Failed to get user info with error = " . $db->error_msg);
} else {
    $user_info = $res->first_row('array');
    $res->free_result();
}
print_r($user_info);
//get users
$users = array();
if (FALSE === ($res = $db->query('SELECT uid, username, dob, mobile, address FROM register_user WHERE uid = ?', array((int) $uid)))) {
    error_log(__METHOD__ . " Failed to get user info with error = " . $db->error_msg);
} else {
    $users = $res->result('array');
    $res->free_result();
}
print_r($users);
开发者ID:songliqiangcn,项目名称:mysql_db,代码行数:22,代码来源:example.php

示例11: error

<?php

//$shopnr = $_GET['Shop'];
$shopnr = '';
include_once "conf{$shopnr}.php";
include_once "error.php";
//Fehlerinstanz
$api = php_sapi_name();
$err = new error($api);
include_once "dblib.php";
include_once "pepper.php";
include_once "erplib.php";
$erpdb = new mydb($ERPhost, $ERPdbname, $ERPuser, $ERPpass, $ERPport, 'pgsql', $err, $debug);
$shopdb = new mydb($SHOPhost, $SHOPdbname, $SHOPuser, $SHOPpass, $SHOPport, 'mysql', $err, $debug);
$sql = "SELECT k_ID,Kunden_NR FROM kunde WHERE Kunden_NR != '0'";
$kunden = $shopdb->getAll($sql);
$sqlkdnr = "SELECT customernumber FROM customer WHERE id = ";
$sqlupd = "UPDATE kunde SET Kunden_NR = '%s' WHERE k_ID = %d";
if ($kunden) {
    foreach ($kunden as $nr) {
        $rs = $erpdb->getOne($sqlkdnr . $nr['kunden_nr']);
        if (isset($rs['customernumber'])) {
            echo $nr['k_id'] . " -> " . $rs['customernumber'] . "\n";
            $rc = $shopdb->query(sprintf($sqlupd, $rs['customernumber'], $nr['k_id']));
        }
    }
}
开发者ID:vanloswang,项目名称:kivitendo-crm,代码行数:27,代码来源:mkShopID2KDnr.php

示例12: gotoindex

session_start();
include "setting.php";
if (!isset($_SESSION['id']) || !isset($_SESSION['ipaddress'])) {
    gotoindex();
}
check_login();
if (!post_check()) {
    exit(0);
}
include "header.php";
$pwd = $_POST['pwd'];
$newpwd = $_POST['newpwd'];
$login_name = $_SESSION['login_name'];
$db = new mydb();
$query = "select * from member where login_name=\$1";
$result = $db->query($query, array($login_name));
$row = pg_fetch_assoc($result, 0);
if (password_verify($pwd, $row['pwd'])) {
    // パスワードが正しい
    $ck = check_new_pwd($newpwd);
    if ($ck != '') {
        print $ck;
        include "footer.php";
        return;
    }
    $newpasswd = password_hash($newpwd, PASSWORD_DEFAULT);
    $sql1 = "UPDATE member SET pwd = \$1 WHERE login_name = \$2";
    $result1 = $db->query($sql1, array($newpasswd, $login_name), "get");
    print "パスワードを更新しました。";
} else {
    print "現在のパスワードが間違っています。";
开发者ID:ryucd,项目名称:Shindan,代码行数:31,代码来源:change_pwd.php


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