本文整理汇总了PHP中db::exec方法的典型用法代码示例。如果您正苦于以下问题:PHP db::exec方法的具体用法?PHP db::exec怎么用?PHP db::exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db
的用法示例。
在下文中一共展示了db::exec方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_answer_action
public function add_answer_action($params)
{
$a = arr::extract($params, ['question_id', 'content', 'type']);
db::exec($this->db, "INSERT INTO i_answers (question_id, content, type) VALUES(:question_id, :content, :type)", [':question_id' => $a['question_id'], ':content' => $a['content'], ':type' => $a['type']]);
$curr_a = db::last_id($this->db);
$this->view->render('json', $curr_a);
}
示例2: get_interviews_list_action
public function get_interviews_list_action($params)
{
$i_meta = db::exec($this->db, "SELECT m.*, DATE(m.date) as date_only, COUNT(i.id) as ans_cnt FROM i_interview_meta m RIGHT JOIN i_interview i ON m.id = i.meta_id GROUP BY i.meta_id", null);
$q = db::exec($this->db, "SELECT * FROM i_questions", null);
$i = arr::array_to_hash_id(db::exec($this->db, "SELECT * FROM i_interview", null));
$u = arr::array_to_hash_id(db::exec($this->db, "SELECT * FROM i_users", null));
$this->view->render('json', ['interviews_list' => $i_meta, 'interview_logs' => $i, 'users' => $u, 'questions' => $q]);
}
示例3: signOut
public function signOut($userId, $hash)
{
$sql = 'delete from `users_sessions` where `user_id` = ? and `hash` = ? limit 1';
db::exec($sql, [$userId, $hash]);
$this->model('session')->remove('userId');
$this->model('session')->remove('userSessionHash');
setcookie($this->model('session')->getName(), '', time() - 42000);
session_destroy();
header('Location: /');
exit;
}
示例4: checkExistingSheetEntity
public function checkExistingSheetEntity($searchCriteria, $findBy = 0, $entity = null)
{
$sql = 'select pge.entity_id, pge.uid, pge.info, pge.e_type from packed_general_entities pge where pge.' . (!$findBy ? 'uid' : 'entity_id') . ' = ?';
$args = [$searchCriteria];
if ($entity) {
array_push($args, $entity);
$sql .= ' and pge.e_type = ?';
}
return db::exec($sql . ' limit 1', $args);
}
示例5: getInitialInfoByEmail
public function getInitialInfoByEmail($email)
{
$sql = "select `id`, `password`, `salt`, `is_active`, `is_confirmed`, `entity_id`, concat(`first_name`, ' ', `surname`) as initials from `users` where `email` = ? limit 1";
return db::exec($sql, $email);
}
示例6: db
define('DB_PORTRO', '');
//留空
define('DB_TYPE', 'sqlite');
define('DB_PATH', 'db3.db');
define('DB_A', '');
$DB = new db();
//判断数据库文件是否存在
if (!file_exists("db3.db")) {
$sql = '
CREATE TABLE "opera"(
[id] integer PRIMARY KEY AUTOINCREMENT
,[cishu] text
,[daxiao] text
);
';
$DB->exec($sql);
$DB->insert('opera', array('cishu' => '0', 'daxiao' => '0'));
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
if (function_exists("curl_init")) {
$row = $DB->select('*', 'opera')->fetchALL();
$row = $row['0'];
$cs = $row['cishu'];
$dx = sizecount($row['daxiao']);
$ym = $_SERVER['SERVER_NAME'] . $_SERVER["PHP_SELF"];
$text = '
<!DOCTYPE HTML>
<html>
<body>
<h1>Opera Mini Mirror Server</h1>
<p>欢迎使用Opera Mini的镜像服务器,您只需要有一个支持变更服务器的Opera Mini就可以使用本程序!</p>
示例7: checkExistingEmail
public function checkExistingEmail($email)
{
return db::exec('select id from users where email = :email limit 1', [':email' => $email]);
}
示例8: unset
} else {
echo '<div class="error">', $error, '</div>';
}
unset($bd);
if ($instalacion) {
/// actualizamos los modulos sys y admin
require_once 'admin/modulo.php';
$nuevo_modulo = new modulo_();
$nuevo_modulo->actualizar();
$bd = new db();
if ($bd->conectar()) {
/// insertamon el usuario admin
$password = sha1('admin');
$consulta = "INSERT INTO fs_usuarios (usuario,pass) VALUES ('admin','{$password}');";
$consulta .= "INSERT INTO fs_ack (usuario,modulo) VALUES ('admin','admin');";
if ($bd->exec($consulta)) {
echo "<div class='mensaje'>Usuario creado correctamente</div>";
} else {
echo "<div class='error'>Error al crear el usuario admin</div>";
}
echo "<br/><br/>\n <div class='centrado'>\n <h1>¡ facturaScripts instalado satisfactoriamente !</h1> Ya puedes comenzar a usarlo.<br/>\n No te olvides de instalar los módulos y actualizar la base de datos.<br/><br/>\n <b>Usuario:</b> admin<br/><b>Contraseña:</b> admin<br/>\n <br/><a href='index.php'>Entrar</a>";
} else {
echo "<div class='error'>Error al conectar a la base de datos</div>";
}
echo "</div>";
} else {
echo "<br/><br/>\n", "<div class='centrado'><a href='index.php'>Entrar</a></div>";
}
echo "</div>\n";
} else {
echo "<div class='copyright'>Error al conectar a la base de datos</div>\n";
示例9: removeLike
public function removeLike($entityId, $entityUserId)
{
$sql = 'delete from likes where `entity_id` = ? and `entity_id_user` = ? limit 1';
return db::exec($sql, [$entityId, $entityUserId]);
}
示例10: get_users_list_action
public function get_users_list_action($params)
{
$result = db::exec($this->db, "SELECT id, name, role FROM i_users", null);
$this->view->render('json', $result);
}
示例11: checkFriendship
public function checkFriendship($uId1, $uId2)
{
$sql = 'select exists(select entity_user_id1 from friends where (entity_user_id1 = :u1 and entity_user_id2 = :u2) or (entity_user_id1 = :u2 and entity_user_id2 = :u1) limit 1) as fExists';
return (bool) array_filter(db::exec($sql, [':u1' => $uId1, ':u2' => $uId2]));
}