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


PHP Projects::update方法代碼示例

本文整理匯總了PHP中Projects::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP Projects::update方法的具體用法?PHP Projects::update怎麽用?PHP Projects::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Projects的用法示例。


在下文中一共展示了Projects::update方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: header

         $_SESSION['msg'] = "Sua inserção falhou!";
         header('Location:../views/projects.php');
     }
     break;
 case 'update':
     if ($_POST['address'] != '' && $_POST['title'] != '') {
         if ($_FILES['image']['tmp_name'] != '') {
             if (is_uploaded_file($_FILES['image']['tmp_name'])) {
                 $_POST['image'] = resizer($_FILES['image']);
             }
         } else {
             $_POST['image'] = Projects::selectImage($_POST['id'], $connect);
         }
         $projects = new Projects($_POST);
         try {
             $projects->update($_POST['id'], $connect);
             $_SESSION['msg'] = "Sua edição foi realizada com sucesso!";
             header('Location:../views/projects.php');
         } catch (PDOException $e) {
             $_SESSION['msg'] = "Sua edição falhou!";
             header('Location:../views/projects.php');
         }
     }
     break;
 case 'delete':
     if (isset($_POST['id'])) {
         if (Projects::delete($_POST['id'], $connect)) {
             $_SESSION['msg'] = "Serviço deletado.";
             header('Location:../views/projects.php');
         }
     } else {
開發者ID:iagosilvany,項目名稱:projeto2,代碼行數:31,代碼來源:projects.php

示例2: die

<?php

ini_set('date.timezone', 'America/Los_Angeles');
include 'config.php';
// need to set the database type for PDO factory
$ConfigArray['DBDSN']['phptype'] = 'mysql';
//include 'A/Db/Pdo.php';
include 'A/Db/Tabledatagateway.php';
class Projects extends A_Db_Tabledatagateway
{
}
$db = new A_Db_Pdo($ConfigArray['DBDSN']);
$db->connect();
if ($db->isError()) {
    die('ERROR: ' . $db->getMessage());
}
$project = new Projects($db, 'users');
$rows = $project->find(1);
dump($project->sql);
dump($rows);
// Get the current row
dump($rows->current());
// Get all rows
$all = $rows->fetchAll();
dump($all);
// Update some data
$data = array('lastname' => 'testert');
$updated = $project->update($data, 'id = 1');
//dump($updated);
$rows = $project->find(1);
dump($rows->current());
開發者ID:TheProjecter,項目名稱:skeleton,代碼行數:31,代碼來源:tabledatagateway_pdo.php


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