本文整理汇总了PHP中CRUD::update方法的典型用法代码示例。如果您正苦于以下问题:PHP CRUD::update方法的具体用法?PHP CRUD::update怎么用?PHP CRUD::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRUD
的用法示例。
在下文中一共展示了CRUD::update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CRUD
<?php
include "model/_crud.mysqli.oop.php";
$crud = new CRUD("localhost", "root", "", "restoran");
$keterangan = @$_POST['keterangan'];
$no = @$_POST['id'];
$nama = @$_POST['nama'];
$gambar = @$_FILES['gambar']['tmp_name'];
$target = 'tampilan/img/';
$harga = @$_POST['harga'];
$nama_gambar = @$_FILES['gambar']['name'];
$pindah = move_uploaded_file($gambar, $target . $nama_gambar);
if ($pindah) {
$data = array('nama' => $nama, 'gambar' => $nama_gambar, 'harga' => $harga, 'keterangan' => $keterangan);
$crud->update("makanan", $data, "no = '{$no}'");
header('location:admin.php');
} else {
?>
<script type="text/javascript">
alert('gambar gagal di upload');
</script>
<?php
echo "ada yang salah";
}
示例2: CRUD
<?php
// TACOPS for CRUD
include 'crud.php';
session_start();
$requests = $_POST;
$CRUD = new CRUD();
foreach ($requests as $request) {
if ($request['type'] == 'read') {
$query = $request['query'];
$result = $CRUD->read($query);
}
if ($request['type'] == 'create') {
$query = $request['query'];
$result = $CRUD->create($query);
}
if ($request['type'] == 'update') {
$query = $request['query'];
$result = $CRUD->update($query);
}
echo $result;
}