本文整理汇总了PHP中crud::query方法的典型用法代码示例。如果您正苦于以下问题:PHP crud::query方法的具体用法?PHP crud::query怎么用?PHP crud::query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类crud
的用法示例。
在下文中一共展示了crud::query方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: crud
<?php
session_start();
require_once 'classes/crud.php';
if (!empty($_POST)) {
$project_name = $_POST['project_name'];
$idworkerProject = $_SESSION['workerId'];
$idclient = $_POST['idclient'];
$dbObject = new crud('projects');
$projectQuery = "INSERT INTO projects VALUES ('', '{$project_name}' , '{$idworkerProject}', '1', '{$idclient}')";
if ($dbObject->query($projectQuery)) {
//Вставка записи проекта
$idproject = $dbObject->getMaxId('projects');
$names = $_POST['name'];
$summaries = $_POST['summary'];
$startdates = $_POST['startdate'];
$finishdates = $_POST['finishdate'];
$idworkers = $_POST['worker'];
$descriptions = $_POST['description'];
$query = "INSERT INTO tasks VALUES ";
for ($i = 0; $i < count($_POST['name']); $i++) {
$set .= " ( {$names[$i]}, {$summaries[$i]}, {$startdates[$i]}, {$finishdates[$i]}, {$idproject}, {$idworkers[$i]}, {$descriptions[$i]} ),";
}
$set = substr($set, 0, -1);
$query = $query . $set;
if ($dbObject->query($query)) {
echo "Создание проекта заверешно";
} else {
echo "Возникли ошибки при добавлении задач";
}
} else {
示例2: crud
<?php
session_start();
$workerId = $_SESSION['workerId'];
if (!empty($_POST['idTask'])) {
$idTask = $_POST['idTask'];
require_once 'classes/crud.php';
$dbObject = new crud('tasks');
$query = "UPDATE tasks SET opened = 0 WHERE id = '{$idTask}' ";
$dbObject->query($query);
}
示例3: crud
<?php
session_start();
$workerId = $_SESSION['workerId'];
if (!empty($_POST['commentText']) && !empty($_POST['idTask']) && !empty($_POST['commentText'])) {
$commentText = $_POST['commentText'];
$idTask = $_POST['idTask'];
$commentText = $_POST['commentText'];
require_once 'classes/crud.php';
$dbObject = new crud('tasks');
$query = "INSERT INTO comments VALUES ('', '{$workerId}', '{$idTask}', '{$commentText}')";
if ($dbObject->query($query)) {
echo true;
} else {
echo false;
}
}