当前位置: 首页>>代码示例>>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;未经允许,请勿转载。