本文整理汇总了PHP中Connector::query方法的典型用法代码示例。如果您正苦于以下问题:PHP Connector::query方法的具体用法?PHP Connector::query怎么用?PHP Connector::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connector
的用法示例。
在下文中一共展示了Connector::query方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
$q = [];
$id = Connector::query('SELECT MAX(id) FROM projects');
$id = $id[0]['MAX(id)'] > 0 ? $id[0]['MAX(id)'] + 1 : 1;
//echo $id;
array_push($q, "INSERT INTO projects (id, name, description, insertBy) VALUES(" . $id . ",'" . $this->name . "','" . $this->description . "'," . $this->insertBy . ")");
array_push($q, "INSERT INTO users_projects VALUES('" . $this->insertBy . "','" . $id . "')");
$res = Connector::queryTran($q);
//print_r($res);
}
示例2: hCheck
public static function hCheck($hash)
{
$query = "SELECT id,logged, password FROM users";
$res = Connector::query($query);
foreach ($res as $r) {
if (in_array($hash, $r, false)) {
$hash1 = hash_hmac('ripemd160', $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR'], $r['password']);
if ($hash1 === $hash) {
return $r['id'];
}
}
}
return false;
}
示例3: Connector
<?php
require_once "classes/db.php";
if (!empty($_POST)) {
$object = $_POST['object'];
$value = $_POST['value'];
$type = $_POST['type'];
$speed = $_POST['speed'];
$al = $_POST['al'];
$db = new Connector();
if (strcmp($al, "asset") == 0) {
$db->query("insert into assets(object, value, type, speed) values (:object, :value, :type, :speed)");
$db->bind(":object", $object);
$db->bind(":value", $value);
$db->bind(":type", $type);
$db->bind(":speed", $speed);
$db->execute();
} else {
if (strcmp($al, "liability") == 0) {
$db->query("insert into liabilities(object, value, type, speed) values (:object, :value, :type, :speed)");
$db->bind(":object", $object);
$db->bind(":value", $value);
$db->bind(":type", $type);
$db->bind(":speed", $speed);
$db->execute();
}
}
}
header("Location: ../");
示例4:
</ul>
<div class="tab-content" style="border: 1px solid lightgray; border-top: none;">
<div role="tabpanel" class="tab-pane active" id="al" >
<br>
<div class="col-md-12">
<button class="btn btn-default" data-toggle="modal" data-target="#register_al"><span class="glyphicon glyphicon-plus"></span> Register new</button>
</div>
<div class="col-md-6">
<h3 class="text-success">Assets <small class="text-success"><span class="glyphicon glyphicon-arrow-up"></span></small></h3>
<table class="table table-hover">
<tr>
<th>Object</th>
<th>Speed</th>
</tr>
<?php
$db->query("select * from assets order by id desc;");
foreach ($db->resultset() as $asset) {
$id = $asset['id'];
$object = $asset['object'];
$value = $asset['value'];
$type = $asset['type'];
$speed = $asset['speed'];
$sign = "\$";
if (strcmp($type, "tugrug") == 0) {
$sign = "₮";
$type = "t";
} else {
if (strcmp($type, "dollar") == 0) {
$sign = "\$";
$type = "d";
}
示例5: implode
// Copyright (C) 2016 Allard van Altena
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
header("Content-disposition: attachment; filename=articles.csv");
header("Content-Type: text/csv");
require_once "config.php";
require_once "database.php";
$db = new Connector();
$db->connect($config);
// Get articles from DB
$articles = $db->query("SELECT * FROM Articles");
$output = array();
while ($article = $articles->fetch_array()) {
// Filter articles with an empty abstract
if ($article["abstract"] != "") {
// Filter any non characters, retain a-z, - and spaces
// Merge title and abstract into one CSV row
$text = preg_replace("/[^a-zA-Z'\\-\\ ]/", "", $article["title"] . " " . $article["abstract"]);
array_push($output, $text);
}
}
// Echo output as CSV
echo implode(",\n", $output) . "\n";
示例6: logout
public static function logout($key)
{
$res = Connector::query("UPDATE users SET logged = NULL where logged ='" . $key . "'");
//echo var_dump($res);
return $res === true ? "true" : "false";
}