0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

中古ノート、買ってみた。 その18

Last updated at Posted at 2025-09-14

概要

中古ノート買ってみた。
wsl1、入れてみた。
ubuntu18.04 、入れてみた。
apache2,php,sqlite、入れてみた。
phpフレームワーク、cheetanを見つけたので、やってみた。
CRUDを実装する。
update.php

写真

image.png

サンプルコード

<?php
	require_once 'cheetan.php';
	function action(&$c) {
		if (count($_POST))
		{
			$param = array ('name' => $_POST['test/name'], 'age' => $_POST['test/age']);
			$c->db->where('id', $_POST['test/id'])->update('test')->values($param)->execute();
		}
		$c->set('data', $c->db->select('*')->from('test')->where('id', $_GET['id'])->limit(1)->execute());
	}
?>
<form method="post" action="update.php">
	name<br />
	<input type="text" name="test/name" value="<?php echo $data['data'][0]['name']; ?>" /><br />
	age<br />
	<input type="text" name="test/age" value="<?php echo $data['data'][0]['age']; ?>" /><br />
	<input type="hidden" name="test/id" value="<?php echo $data['data'][0]['id']; ?>" />
	<input type="submit" value="update" />
</form>




以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?