本文整理汇总了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 {
示例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());