當前位置: 首頁>>代碼示例>>PHP>>正文


PHP crud::query方法代碼示例

本文整理匯總了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 {
開發者ID:VladislavMaslakov,項目名稱:crm-beta,代碼行數:31,代碼來源:add_projectAjax.php

示例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);
}
開發者ID:VladislavMaslakov,項目名稱:crm-beta,代碼行數:11,代碼來源:closeTask.php

示例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;
    }
}
開發者ID:VladislavMaslakov,項目名稱:crm-beta,代碼行數:17,代碼來源:addCommentToTask.php


注:本文中的crud::query方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。