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


PHP Database::executeQuery方法代码示例

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


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

示例1: doSave

 private function doSave($item, $value, $environment, $group, $namespace = null)
 {
     $connection = $this->getConnection();
     $query = $connection->createQueryBuilder();
     if (is_array($value)) {
         foreach ($value as $key => $val) {
             $key = ($item ? $item . '.' : '') . $key;
             $this->doSave($key, $val, $environment, $group, $namespace);
         }
         return;
     }
     $query->update('Config', 'c')->set('configValue', $query->expr()->literal($value))->where($query->expr()->comparison('configGroup', '=', $query->expr()->literal($group)));
     if ($item) {
         $query->andWhere($query->expr()->comparison('configItem', '=', $query->expr()->literal($item)));
     }
     $query->andWhere($query->expr()->comparison('configNamespace', '=', $query->expr()->literal($namespace ?: '')));
     if (!$query->execute()) {
         try {
             $query = "INSERT INTO Config (configItem, configValue, configGroup, configNamespace) VALUES (?, ?, ?, ?)";
             \Database::executeQuery($query, array($item, $value, $group, $namespace ?: ''));
         } catch (\Exception $e) {
             // This happens when the update succeeded, but didn't actually change anything on the row.
         }
     }
 }
开发者ID:digideskio,项目名称:concrete5,代码行数:25,代码来源:DatabaseSaver.php

示例2: commit

 /**
  * Commit current tracking data.
  * @param $groupId
  */
 public function commit($groupId)
 {
     $sql = "UPDATE dbtrack_actions SET groupid = :groupid WHERE groupid = 0";
     $this->dbms->executeQuery($sql, array('groupid' => $groupId));
     // Count new actions.
     $count = $this->dbms->getResult('SELECT COALESCE(COUNT(id), 0) AS actions FROM dbtrack_actions WHERE groupid = :groupid', array('groupid' => $groupId));
     return $count->actions;
 }
开发者ID:sadreck,项目名称:dbtrack_old,代码行数:12,代码来源:DBManager.php

示例3: getInstance

 public static function getInstance()
 {
     if (!self::$instance) {
         if (!file_exists(DB_DIR . "driver_db")) {
             $db = new Database(ROOT_DATABASE);
             $db->executeQuery("CREATE DATABASE driver_db");
         }
         self::$instance = new Database("driver_db");
     }
     return self::$instance;
 }
开发者ID:nunoflores,项目名称:driver,代码行数:11,代码来源:db.php

示例4: getDataFromDb2

 public function getDataFromDb2()
 {
     $db = new Database();
     $db->executeQuery("SELECT * FROM cars");
     return $db->getAllRows();
     //       $a = NULL;
     //       $a = 100;
     //        if (isset($a)) {
     //            echo "set";
     //        } else {
     //            echo 'not set';
     //        }
     //       return $a;
 }
开发者ID:prajeenapk,项目名称:VioletPHP,代码行数:14,代码来源:dbModel.php

示例5: getEntitiesFromList

 public function getEntitiesFromList($listId, $return, $offset)
 {
     // for now, ignoring return & offset - will return all products in list
     $query = 'call getProductsByEntityListIdEx(' . $listId . ',' . $this->tenantid . ',' . $offset . ',' . $return . ')';
     $data = Database::executeQuery($query);
     $entity = '';
     if ($data->num_rows == 0) {
         return array();
     }
     while ($r = mysqli_fetch_assoc($data)) {
         $entities[] = $r;
     }
     return $entities;
 }
开发者ID:robertmoss,项目名称:foodfinder_main,代码行数:14,代码来源:product.php

示例6: Yflatfile

 public function Yflatfile($url)
 {
     $url = parse_url($url);
     // Decode url-encoded information in the db connection string
     $url['path'] = urldecode($url['path']);
     //Check if the database exists
     $dbname = substr($url['path'], 1);
     if (!file_exists(DB_DIR . $dbname)) {
         $db = new Database(ROOT_DATABASE);
         $create_db_sql = "CREATE DATABASE {$dbname}";
         if (!$db->executeQuery($create_db_sql)) {
             die(txtdbapi_get_last_error());
         }
     }
     $this->lnk = new Database($dbname);
 }
开发者ID:yunsite,项目名称:mapleleaf,代码行数:16,代码来源:Yflatfile.php

示例7: getAvailableChildren

 public function getAvailableChildren($fieldname)
 {
     if ($fieldname == "pageCollections") {
         $query = "select id, name from pageCollection where tenantid=" . $this->tenantid;
         $results = Database::executeQuery($query);
         if ($results->num_rows == 0) {
             return array();
         } else {
             $entities = array();
             while ($r = mysqli_fetch_assoc($results)) {
                 $entities[] = $r;
             }
             return $entities;
         }
         return $results->fetch;
     } else {
         return parent::getAvailableChildren($fieldname);
     }
 }
开发者ID:robertmoss,项目名称:foodfinder_main,代码行数:19,代码来源:page.php

示例8: perform

 static function perform()
 {
     $db = new Database();
     $rows = $db->executeQuery("SELECT * FROM MailQueue WHERE sent = 0");
     if (is_array($rows) && count($rows) > 0) {
         foreach ($rows as $data) {
             $result = Emailer::send([$data['senderEmail'] => $data['senderName']], [$data['receiverEmail']], $data['subject'], $data['body']);
             if ($result) {
                 $params = ['id' => $data['id'], 'sent' => 1, 'now' => date('Y-m-d H:i:s')];
                 $r = $db->executeUpdate("UPDATE MailQueue SET sentAt=:now, sent=:sent WHERE id = :id", $params);
                 if ($r) {
                     print "[{$data['subject']}] Email sent to: " . $data['receiverEmail'] . PHP_EOL;
                 } else {
                     print "[{$data['subject']}] Failed to send email for: " . $data['receiverEmail'] . PHP_EOL;
                 }
             }
         }
     }
 }
开发者ID:arjayads,项目名称:php-simple-auth,代码行数:19,代码来源:MailerCron.php

示例9: generateKE_1

 public function generateKE_1($elementObj)
 {
     $db = new Database();
     $query = "SELECT `E` FROM `ba_mat` WHERE `rcdNo`=";
     if ($elementObj->PK4ba_mat == 2) {
         $query .= "22";
     } elseif ($elementObj->PK4ba_mat == 0) {
         $query .= "23";
     }
     $dataset = $db->executeQuery($query);
     $r = $dataset->fetch_assoc();
     $E = $r['E'];
     $I = $elementObj->PK4ba_g;
     $EI = $E * $I;
     $le = $elementObj->getLength();
     $v1 = $EI * 12 / pow($le, 3);
     $v2 = $EI * 6 / pow($le, 2);
     $v3 = $EI * 4 / $le;
     $v4 = pow($EI, 2) / $le;
     $k_e = array(array($v1, $v2, -$v1, $v2), array($v2, $v3, -$v2, $v4), array(-$v1, -$v2, $v1, -$v2), array($v2, $v4, -$v2, $v3));
     return $k_e;
 }
开发者ID:lightbringer1991,项目名称:Projects,代码行数:22,代码来源:FEA.class.php

示例10: executeQueryReturnArray

 public static function executeQueryReturnArray($query)
 {
     // executes the specified query and returns a multidimensional associative array with the results
     $data = Database::executeQuery($query);
     $resultSet = array();
     while ($row = mysqli_fetch_assoc($data)) {
         array_push($resultSet, $row);
     }
     return $resultSet;
 }
开发者ID:robertmoss,项目名称:foodfinder_main,代码行数:10,代码来源:database.php

示例11: updatepassword

 public function updatepassword($pass)
 {
     $secure_pass = generateHash($pass);
     $query = "UPDATE user SET password = " . Database::queryString($secure_pass) . ' WHERE id = ' . Database::queryNumber($this->id);
     return Database::executeQuery($query);
 }
开发者ID:robertmoss,项目名称:foodfinder_main,代码行数:6,代码来源:user.php

示例12: Database

<?php

include "./db-api/txt-db-api.php";
$db = new Database("database_EAM");
$a = 0;
$username = $_POST['name'];
$password = $_POST['password'];
$er1 = "&nbsp &nbsp <font color=red>Invalid username/password</font>";
$redirect = "./index.php?er={$er1}";
$rs = $db->executeQuery("SELECT * FROM user;");
//get all rows
while ($rs->next()) {
    //read next line
    list($usernam, $passwor) = $rs->getCurrentValues();
    //do whatever you wish...
    if ($username == $usernam && $a != 2) {
        $a = 55;
        /*exei username apo thn vash user*/
        if ($password == $passwor) {
            $a = 2;
            /*vrhkame ton xrhsth*/
            session_start();
            /*if (!isset($_SESSION['count'])) {
            			 	$_SESSION['count'] = 0;
            		} else {
             				$_SESSION['count']++;
            		}*/
            unset($_SESSION["login_message"]);
            $_SESSION["isLoggedIn"] = 1;
            $_SESSION["uname"] = $username;
            $_SESSION["type"] = "user";
开发者ID:Giannos99,项目名称:HC_Interaction,代码行数:31,代码来源:login.php

示例13: VALUES

    echo " Δώσατε λάθος πόλη. \n<br>";
    $a = 1;
}
if (preg_match($regex1, $dieu8unsh)) {
    # valid name
} else {
    echo " Δώσατε λάθος διεύθυνση. \n<br>";
    $a = 1;
}
if (is_numeric($tk)) {
} else {
    echo " Δώσατε λάθος ταχυδρομικό κώδικα.\n<br>";
    $a = 1;
}
if ($oroi_xrhshs != NULL and $oroi_xrhshs1 != NULL and $sign_up == 'user' and $a != 1) {
    $resultset = $db->executeQuery("INSERT INTO user  VALUES ('" . $username . "','" . $password . "','" . $ar_taut . "','" . $onoma . "','" . $epitheto . "','" . $nomos . "','" . $polh . "','" . $dieu8unsh . "','" . $tk . "','" . $mail . "') ");
}
if ($oroi_xrhshs != NULL and $oroi_xrhshs1 != NULL and $sign_up == 'doctor' and $a != 1) {
    /*$resultset1=$db->executeQuery("SELECT COUNT(*) FROM doctor");
    	(username, password, ar_taut, onoma, epitheto, nomos, polh, dieu8unsh, tk,email)
    	(username, password, ar_taut, onoma, epitheto, nomos, polh, dieu8unsh, tk,email, eidikothta, dieu8_iatreiou) 
    	printf("resultset1= %d ",$resultset1);*/
    $resultset = $db->executeQuery("INSERT INTO doctor VALUES ('" . $username . "','" . $password . "','" . $ar_taut . "','" . $onoma . "','" . $epitheto . "','" . $nomos . "','" . $polh . "','" . $dieu8unsh . "','" . $tk . "','" . $mail . "','" . $ar_ad . "','" . $eidikothta . "','" . $dieu8_iatreiou . "') ");
}
if ($oroi_xrhshs == NULL || $oroi_xrhshs1 == NULL) {
    printf("Δεν έχετε συμφωνήσει με τους όρους χρήσης\n");
    $a = 1;
}
if ($a != 1) {
    echo "<br/><br/><br/>DOCTORS<br/>";
    $rs = $db->executeQuery("SELECT * FROM doctor;");
开发者ID:Giannos99,项目名称:HC_Interaction,代码行数:31,代码来源:insert_doctor.php

示例14: Database

include "../_includes/SSDA_librarydatabase.php";
//SSDA_menubar.php has the menu code for da_catalog, da_catalog_fielder(fielder collection) and 'archive reources'
// class for database connections
include "../_classes/class.Database.php";
$query = "select title.StudyNum, title.Title FROM title where title.Restricted <> '*' ORDER BY title.StudyNum";
// sql query statement
// NOTE: original query did not exclude the Restricted items
// $query = "select title.Title, title.StudyNum, shfull.subject, Left(shfull.subject,1) AS firstLetterIndex, count(*) as titlePerSubjectCount FROM (title INNER JOIN shcode ON title.tisort = shcode.tisort) INNER JOIN shfull ON shcode.subjectcode = shfull.subjectcode group by shfull.subject ORDER BY shfull.subject";
// echo "<br>$query<br>";
// class.Database.php  is the class to make PDO connections
// initialize new db connection instance
$db = new Database();
// prepare query
$db->prepareQuery($query);
// execute query
$result = $db->executeQuery();
//$result = $db->resultset();  // execute the query
if (!$result) {
    die("Could not query the database: <br />");
}
// else {  echo "Successfully queried the database.<br>";   }  // for debugging
// the index term list
$studynumberList = array();
echo "<form action='da_catalog_titleRecord.php' method='put' name='studynumber' target='_self'>";
echo "<select name='studynumber' class='alphaTitleList'>";
$row_index = 0;
while ($row = $db->getRow()) {
    $title = $row['Title'];
    $tempStudynumber = $row['StudyNum'];
    // code to insure that the studynumbers sort correctly
    $numeric_only = preg_replace('/[a-zA-Z]/', '', $tempStudynumber);
开发者ID:jmjamison,项目名称:da_catalog,代码行数:31,代码来源:da_catalog_studynumbers.php

示例15: splitSql

    $query = $_POST['sql'];
} else {
    $query = "SELECT * FROM " . $_GET['tbl'] . " LIMIT " . $_POST['o'] . "," . $_POST['l'];
}
if (stristr($query, "limit")) {
    $use_limit = true;
} else {
    $use_limit = false;
}
$singleQueries = splitSql($query);
$num_queries = count($singleQueries);
$total = 0;
$tbl_view_rows = "";
for ($j = 0; $j < $num_queries; $j++) {
    $localTotal = 0;
    $res = $db->executeQuery($singleQueries[$j]);
    $phase = "{tablec}";
    $tbl_view_cols = "";
    $list_colnames = $res->getColumnNames();
    $numfields = count($list_colnames);
    for ($i = 0; $i < $numfields; $i++) {
        $field = $list_colnames[$i];
        eval("\$tbl_view_cols .= \"" . gettemplate("table_view_colbit") . "\";");
    }
    eval("\$tbl_view_rows .= \"" . gettemplate("table_view_start_table") . "\";");
    eval("\$tbl_view_rows .= \"" . gettemplate("table_view_rowbit") . "\";");
    $phase = "{tablea}";
    while ($res->next()) {
        $tbl_view_cols = "";
        $row = $res->getCurrentValues();
        for ($i = 0; $i < count($row); $i++) {
开发者ID:Kent-Liang,项目名称:Network-Security,代码行数:31,代码来源:table_view.php


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