本文整理汇总了PHP中pdo_query函数的典型用法代码示例。如果您正苦于以下问题:PHP pdo_query函数的具体用法?PHP pdo_query怎么用?PHP pdo_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pdo_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Insert
function Insert()
{
if (!$this->BuildId) {
echo "BuildTestDiff::Insert(): BuildId is not set<br>";
return false;
}
if ($this->Type != 0 && empty($this->Type)) {
echo "BuildTestDiff::Insert(): Type is not set<br>";
return false;
}
if (!is_numeric($this->DifferenceNegative)) {
echo "BuildTestDiff::Insert(): DifferenceNegative is not set<br>";
return false;
}
if (!is_numeric($this->DifferencePositive)) {
echo "BuildTestDiff::Insert(): DifferencePositive is not set<br>";
return false;
}
$query = "INSERT INTO testdiff (buildid,type,difference_negative,difference_positive) \n VALUES ('{$this->BuildId}','{$this->Type}','{$this->DifferenceNegative}','{$this->DifferencePositive}')";
if (!pdo_query($query)) {
add_last_sql_error("BuildTestDiff Insert", 0, $this->BuildId);
return false;
}
return true;
}
示例2: doMobileForwardlove
public function doMobileForwardlove()
{
global $_W, $_GPC;
$re = "";
$ops = array('forward', 'praise');
$op = in_array($_GPC['op'], $ops) ? $_GPC['op'] : 'forward';
if ($op == 'forward') {
$id = intval($_GPC['id']);
$re = pdo_query("update " . tablename($this->tb_lovehelper_msg) . " set forward=forward+1 where id=:id and uniacid=:uniacid ", array(":id" => $id, ':uniacid' => $_W['uniacid']));
if ($re) {
echo "0";
} else {
echo '-1';
}
}
if ($op == 'praise') {
$id = intval($_GPC['id']);
$re = pdo_query("update " . tablename($this->tb_lovehelper_msg) . " set praise=praise+1 where id=:id and uniacid=:uniacid ", array(":id" => $id, ':uniacid' => $_W['uniacid']));
if ($re) {
$praise = pdo_fetchcolumn('SELECT praise FROM ' . tablename($this->tb_lovehelper_msg) . 'where id=:id and uniacid=:uniacid', array(":id" => $id, ':uniacid' => $_W['uniacid']));
echo $praise;
} else {
echo '-1';
}
}
}
示例3: GetNumberOfFailures
/** Get the number of tests that are failing */
function GetNumberOfFailures($checktesttiming, $testtimemaxstatus)
{
if (!$this->BuildId) {
echo "BuildTest::GetNumberOfFailures(): BuildId not set";
return false;
}
$sql = "SELECT testfailed,testnotrun,testtimestatusfailed FROM build WHERE id=" . qnum($this->BuildId);
$query = pdo_query($sql);
if (!$query) {
add_last_sql_error("BuildTest:GetNumberOfFailures", 0, $this->BuildId);
return false;
}
$nfail_array = pdo_fetch_array($query);
$sumerrors = 0;
if ($nfail_array['testfailed'] > 0) {
$sumerrors += $nfail_array['testfailed'];
}
if ($nfail_array['testnotrun'] > 0) {
$sumerrors += $nfail_array['testnotrun'];
}
// Find if the build has any test failings
if ($checktesttiming) {
if ($nfail_array['testtimestatusfailed'] > 0) {
$sumerrors += $nfail_array['testtimestatusfailed'];
}
}
return $sumerrors;
}
示例4: testAccountLockout
public function testAccountLockout()
{
// Enable our config settings.
$this->addLineToConfig($this->AttemptsConfig);
$this->addLineToConfig($this->LengthConfig);
// Get the id for the simpletest user.
$user = new User();
$user->Email = 'simpletest@localhost';
if (!$user->Exists()) {
$this->fail("simpletest user does not exist");
return false;
}
$userid = $user->Id;
// Lock the account out by specifying the wrong password multiple times.
$this->login('simpletest@localhost', 'asdf');
$this->login('simpletest@localhost', 'asdf');
// Make sure we get the same error message when we attempt to login
// whether or not we use the correct password.
$this->login('simpletest@localhost', 'asdf');
$this->assertText('Your account is locked');
$this->login('simpletest@localhost', 'simpletest');
$this->assertText('Your account is locked');
// Manually set the lock to expire.
pdo_query("UPDATE lockout SET unlocktime = '1980-01-01 00:00:00'\n WHERE userid={$userid}");
// Make sure we can successfully log in now.
$this->login('simpletest@localhost', 'simpletest');
$this->assertText('Log Out');
$this->removeLineFromConfig($this->AttemptsConfig);
$this->removeLineFromConfig($this->LengthConfig);
$this->pass('Test passed');
}
示例5: testDeleteDailyUpdate
function testDeleteDailyUpdate()
{
//double check that it's the testing database before doing anything hasty...
if ($this->databaseName !== "cdash4simpletest") {
$this->fail("can only test on a database named 'cdash4simpletest'");
return 1;
}
//remove the daily update entry for some projects so that subsequent tests
//will cover dailyupdate.php more thoroughly
$cvsID = get_project_id("InsightExample");
if (!($query = pdo_query("DELETE FROM dailyupdate WHERE projectid='{$cvsID}'"))) {
$this->fail("pdo_query returned false");
return 1;
}
$svnID = get_project_id("EmailProjectExample");
if (!($query = pdo_query("DELETE FROM dailyupdate WHERE projectid='{$svnID}'"))) {
$this->fail("pdo_query returned false");
return 1;
}
$gitID = get_project_id("PublicDashboard");
if (!($query = pdo_query("DELETE FROM dailyupdate WHERE projectid='{$gitID}'"))) {
$this->fail("pdo_query returned false");
return 1;
}
$this->pass("Passed");
}
示例6: Insert
function Insert()
{
$text = pdo_real_escape_string($this->Text);
// Get this->Id from the database if text is already in the label table:
$this->Id = pdo_get_field_value("SELECT id FROM label WHERE text='{$text}'", 'id', 0);
// Or, if necessary, insert a new row, then get the id of the inserted row:
if (0 == $this->Id) {
$query = "INSERT INTO label (text) VALUES ('{$text}')";
if (!pdo_query($query)) {
add_last_sql_error('Label::Insert');
return false;
}
$this->Id = pdo_insert_id('label');
}
// Insert relationship records, too, but only for those relationships
// established by callers. (If coming from test.php, for example, TestId
// will be set, but none of the others will. Similarly for other callers.)
$this->InsertAssociation('label2build', 'buildid', $this->BuildId);
$this->InsertAssociation('label2buildfailure', 'buildfailureid', $this->BuildFailureId);
$this->InsertAssociation('label2coveragefile', 'buildid', $this->CoverageFileBuildId, 'coveragefileid', $this->CoverageFileId);
$this->InsertAssociation('label2dynamicanalysis', 'dynamicanalysisid', $this->DynamicAnalysisId);
$this->InsertAssociation('label2test', 'buildid', $this->TestBuildId, 'testid', $this->TestId);
// TODO: Implement this:
//
//$this->InsertAssociation($this->UpdateFileKey,
// 'label2updatefile', 'updatefilekey');
return true;
}
示例7: Save
/** Save the group */
public function Save()
{
if (!$this->DailyUpdateId) {
echo 'DailyUpdateFile::Save(): DailyUpdateId not set!';
return false;
}
if (!$this->Filename) {
echo 'DailyUpdateFile::Save(): Filename not set!';
return false;
}
if (!$this->CheckinDate) {
echo 'DailyUpdateFile::Save(): CheckinDate not set!';
return false;
}
if ($this->Exists()) {
// Update the project
$query = 'UPDATE dailyupdatefile SET';
$query .= " checkindate='" . $this->CheckinDate . "'";
$query .= ",author='" . $this->Author . "'";
$query .= ",log='" . $this->Log . "'";
$query .= ",revision='" . $this->Revision . "'";
$query .= ",priorrevision='" . $this->PriorRevision . "'";
$query .= " WHERE dailyupdateid='" . $this->DailyUpdateId . "' AND filename='" . $this->Filename . "'";
if (!pdo_query($query)) {
add_last_sql_error('DailyUpdateFile Update');
return false;
}
} else {
if (!pdo_query("INSERT INTO dailyupdatefile (dailyupdateid,filename,checkindate,author,log,revision,priorrevision)\n VALUES ('{$this->DailyUpdateId}','{$this->Filename}','{$this->CheckinDate}','{$this->Author}','{$this->Log}',\n '{$this->Revision}','{$this->PriorRevision}')")) {
add_last_sql_error('DailyUpdateFile Insert');
return false;
}
}
return true;
}
示例8: expectedTest
private function expectedTest($buildname, $projectname)
{
// Mark an old build as expected.
$query = "\n SELECT b.siteid, b.type, g.id AS groupid FROM build AS b\n INNER JOIN build2group AS b2g ON (b.id=b2g.buildid)\n INNER JOIN buildgroup AS g ON (b2g.groupid=g.id)\n WHERE b.name='{$buildname}'";
if ($projectname === 'Trilinos') {
$query .= ' AND b.parentid=-1';
}
$build_row = pdo_single_row_query($query);
$groupid = $build_row['groupid'];
$buildtype = $build_row['type'];
$siteid = $build_row['siteid'];
if (!pdo_query("\n INSERT INTO build2grouprule(groupid,buildtype,buildname,siteid,expected,starttime,endtime)\n VALUES ('{$groupid}','{$buildtype}','{$buildname}','{$siteid}','1','2013-01-01 00:00:00','1980-01-01 00:00:00')")) {
$this->fail("Error marking {$buildname} as expected");
return 1;
}
// Verify that our API lists this build even though it hasn't submitted today.
$this->get($this->url . "/api/v1/index.php?project={$projectname}");
$content = $this->getBrowser()->getContent();
$jsonobj = json_decode($content, true);
$buildgroup = array_pop($jsonobj['buildgroups']);
$found = false;
foreach ($buildgroup['builds'] as $build) {
if ($build['buildname'] == $buildname && $build['expectedandmissing'] == 1) {
$found = true;
}
}
// Make it unexpected again.
pdo_query("DELETE FROM build2grouprule WHERE buildname='{$buildname}'");
if (!$found) {
$this->fail("Expected missing build '{$buildname}' not included");
return 1;
}
$this->pass('Passed');
return 0;
}
示例9: doMobilecoupon
public function doMobilecoupon()
{
global $_GPC, $_W;
$op = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
if ($op == 'display') {
$id = $_GPC['id'];
if (empty($id)) {
message('参数错误');
}
$code = pdo_fetch("SELECT * FROM " . tablename('choose_order') . " WHERE uniacid = '{$_W['uniacid']}' AND openid = '{$_W['openid']}' ");
$codemess = pdo_fetch("SELECT * FROM " . tablename('choose_pro') . " WHERE uniacid = '{$_W['uniacid']}' AND id = '{$id}' ");
include $this->template('code');
}
if ($op == 'post') {
$id = $_GPC['id'];
$code = pdo_fetch("SELECT * FROM " . tablename('choose_order') . " WHERE uniacid = '{$_W['uniacid']}' AND openid = '{$_W['openid']}' AND mobile = '{$_GPC['mobile']}' ");
if (!empty($code['code'])) {
$status = false;
$msg = '您已经领取过优惠券,请勿重复领取!';
} elseif (!empty($code)) {
$carttotal = random(4, 1) . random(4, 1) . random(4, 1);
$data = array('uniacid' => $_W['uniacid'], 'ordersn' => date('md') . random(4, 1), 'openid' => $_W['openid'], 'mobile' => $_GPC['mobile'], 'code' => $carttotal, 'pro_id' => $id, 'createtime' => TIMESTAMP);
pdo_update('choose_order', $data, array('id' => $code['id']));
pdo_query("update " . tablename('choose_pro') . " set youhui_num=youhui_num+1 where id = '{$_GPC['huodong_id']}' ");
} else {
$carttotal = random(4, 1) . random(4, 1) . random(4, 1);
$data = array('uniacid' => $_W['uniacid'], 'ordersn' => date('md') . random(4, 1), 'openid' => $_W['openid'], 'mobile' => $_GPC['mobile'], 'code' => $carttotal, 'pro_id' => $id, 'createtime' => TIMESTAMP);
pdo_insert('choose_order', $data);
pdo_query("update " . tablename('choose_pro') . " set youhui_num=youhui_num+1 where id = '{$_GPC['huodong_id']}' ");
}
$result = array('status' => $status, 'msg' => $msg, 'coupon_bn' => $carttotal);
die(json_encode($result));
}
}
示例10: ruleDeleted
public function ruleDeleted($rid)
{
global $_W;
//删除规则时调用,这里 $rid 为对应的规则编号
$sql = 'DELETE FROM ' . tablename('slotmac_rep') . " WHERE id='{$rid}' AND weid='{$_W['weid']}'";
pdo_query($sql);
}
示例11: doMobileIndex
public function doMobileIndex()
{
global $_W, $_GPC;
// 分享量
if ($_W['isajax'] && $_GPC['op'] == 'share') {
pdo_query("UPDATE " . tablename('qiyue_qiuqian') . " SET sharenum=sharenum+1 WHERE uniacid=:uniacid", array(':uniacid' => $_W['uniacid']));
message(array('error_code' => 0), '', 'ajax');
}
$qian_r = pdo_fetch("SELECT * FROM " . tablename('qiyue_qiuqian') . " WHERE uniacid=:uniacid", array(':uniacid' => $_W['uniacid']));
$morepic = array();
$imgcount = 0;
if ($qian_r['morepic']) {
$f_exp = "::::::";
$r_exp = PHP_EOL;
$rr = explode($r_exp, $qian_r['morepic']);
$imgcount = count($rr);
for ($i = 0; $i < $imgcount; $i++) {
$fr = explode($f_exp, $rr[$i]);
$morepic[] = array('title' => $fr['1'], 'url' => tomedia($fr['0']));
}
}
$_share = $this->module['config'];
unset($_share['cnzzid']);
// 去掉CNZZ
$cnzzid = $this->module['config']['cnzzid'];
// 增加浏览量
pdo_query("UPDATE " . tablename('qiyue_qiuqian') . " SET viewnum=viewnum+1 WHERE uniacid=:uniacid", array(':uniacid' => $_W['uniacid']));
include $this->template('index');
}
示例12: get_related_dates
function get_related_dates($projectname, $basedate)
{
include "cdash/config.php";
require_once "cdash/pdo.php";
$dates = array();
$db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
pdo_select_db("{$CDASH_DB_NAME}", $db);
$dbQuery = pdo_query("SELECT nightlytime FROM project WHERE name='{$projectname}'");
if (pdo_num_rows($dbQuery) > 0) {
$project = pdo_fetch_array($dbQuery);
$nightlytime = $project['nightlytime'];
//echo "query result nightlytime: " . $nightlytime . "<br/>";
} else {
$nightlytime = "00:00:00";
//echo "default nightlytime: " . $nightlytime . "<br/>";
}
if (!isset($basedate) || strlen($basedate) == 0) {
$basedate = gmdate(FMT_DATE);
}
// Convert the nightly time into GMT
$nightlytime = gmdate(FMT_TIME, strtotime($nightlytime));
$nightlyhour = time2hour($nightlytime);
$nightlyminute = time2minute($nightlytime);
$nightlysecond = time2second($nightlytime);
$basemonth = date2month($basedate);
$baseday = date2day($basedate);
$baseyear = date2year($basedate);
$dates['nightly+2'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday + 2, $baseyear);
$dates['nightly+1'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday + 1, $baseyear);
$dates['nightly-0'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday, $baseyear);
$dates['nightly-1'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday - 1, $baseyear);
$dates['nightly-2'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday - 2, $baseyear);
// Snapshot of "now"
//
$currentgmtime = time();
$currentgmdate = gmdate(FMT_DATE, $currentgmtime);
// Find the most recently past nightly time:
//
$todaymonth = date2month($currentgmdate);
$todayday = date2day($currentgmdate);
$todayyear = date2year($currentgmdate);
$currentnightly = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $todaymonth, $todayday, $todayyear);
while ($currentnightly > $currentgmtime) {
$todayday = $todayday - 1;
$currentnightly = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $todaymonth, $todayday, $todayyear);
}
$dates['now'] = $currentgmtime;
$dates['most-recent-nightly'] = $currentnightly;
$dates['today_utc'] = $currentgmdate;
$dates['basedate'] = gmdate(FMT_DATE, $dates['nightly-0']);
// CDash equivalent of DART1's "last rollup time"
if ($dates['basedate'] === $dates['today_utc']) {
// If it's today, it's now:
$dates['last-rollup-time'] = $dates['now'];
} else {
// If it's not today, it's the nightly time on the basedate:
$dates['last-rollup-time'] = $dates['nightly-0'];
}
return $dates;
}
示例13: Insert
function Insert()
{
if (!$this->BuildId) {
echo "BuildUserNote::Insert(): BuildId is not set<br>";
return false;
}
if (!$this->UserId) {
echo "BuildUserNote::Insert(): UserId is not set<br>";
return false;
}
if (!$this->Note) {
echo "BuildUserNote::Insert(): Note is not set<br>";
return false;
}
if (!$this->TimeStamp) {
echo "BuildUserNote::Insert(): TimeStamp is not set<br>";
return false;
}
if (!$this->Status) {
echo "BuildUserNote::Insert(): Status is not set<br>";
return false;
}
$query = "INSERT INTO buildnote (buildid,userid,note,timestamp,status)\n VALUES ('{$this->BuildId}','{$this->UserId}','{$this->Note}','{$this->TimeStamp}','{$this->Status}')";
if (!pdo_query($query)) {
add_last_sql_error("BuildUserNote Insert", 0, $this->BuildId);
return false;
}
return true;
}
示例14: site_cover
/**
* [WeEngine System] Copyright (c) 2014 WE7.CC
* WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
*/
function site_cover($coverparams = array())
{
$where = '';
$params = array(':uniacid' => $coverparams['uniacid'], ':module' => $coverparams['module']);
if (!empty($coverparams['multiid'])) {
$where .= " AND multiid = :multiid";
$params[':multiid'] = $coverparams['multiid'];
}
$cover = pdo_fetch("SELECT * FROM " . tablename('cover_reply') . " WHERE `module` = :module AND uniacid = :uniacid {$where}", $params);
if (empty($cover['rid'])) {
$rule = array('uniacid' => $coverparams['uniacid'], 'name' => $coverparams['title'], 'module' => 'cover', 'status' => 1);
pdo_insert('rule', $rule);
$rid = pdo_insertid();
} else {
$rule = array('name' => $coverparams['title']);
pdo_update('rule', $rule, array('id' => $cover['rid']));
$rid = $cover['rid'];
}
if (!empty($rid)) {
$sql = 'DELETE FROM ' . tablename('rule_keyword') . ' WHERE `rid`=:rid AND `uniacid`=:uniacid';
$pars = array();
$pars[':rid'] = $rid;
$pars[':uniacid'] = $coverparams['uniacid'];
pdo_query($sql, $pars);
$keywordrow = array('rid' => $rid, 'uniacid' => $coverparams['uniacid'], 'module' => 'cover', 'status' => 1, 'displayorder' => 0, 'type' => 1, 'content' => $coverparams['keyword']);
pdo_insert('rule_keyword', $keywordrow);
}
$entry = array('uniacid' => $coverparams['uniacid'], 'multiid' => $coverparams['multiid'], 'rid' => $rid, 'title' => $coverparams['title'], 'description' => $coverparams['description'], 'thumb' => $coverparams['thumb'], 'url' => $coverparams['url'], 'do' => '', 'module' => $coverparams['module']);
if (empty($cover['id'])) {
pdo_insert('cover_reply', $entry);
} else {
pdo_update('cover_reply', $entry, array('id' => $cover['id']));
}
return true;
}
示例15: doPassword
public function doPassword()
{
global $_W, $_GPC;
if (checksubmit('submit')) {
if (!empty($_GPC['title-new'])) {
foreach ($_GPC['title-new'] as $index => $row) {
$data = array('weid' => $_W['weid'], 'name' => $_GPC['title-new'][$index], 'password' => member_hash($_GPC['password-new'][$index], ''));
pdo_insert('card_password', $data);
}
}
if (!empty($_GPC['title'])) {
foreach ($_GPC['title'] as $index => $row) {
$data = array('name' => $_GPC['title'][$index]);
if (!empty($_GPC['password'][$index])) {
$data['password'] = member_hash($_GPC['password'][$index], '');
}
pdo_update('card_password', $data, array('id' => $index));
}
}
if (!empty($_GPC['delete'])) {
pdo_query("DELETE FROM " . tablename('card_password') . " WHERE id IN (" . implode(',', $_GPC['delete']) . ")");
}
message('消费密码更新成功!', referer(), 'success');
}
$list = pdo_fetchall("SELECT * FROM " . tablename('card_password') . " WHERE weid = :weid", array(':weid' => $_W['weid']));
include $this->template('password');
}