本文整理匯總了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;
}