本文整理汇总了PHP中Crud::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Crud::create方法的具体用法?PHP Crud::create怎么用?PHP Crud::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Crud
的用法示例。
在下文中一共展示了Crud::create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save()
{
if (!empty($_POST['username']) && !empty($_POST['password'] != '')) {
$username = $_POST['username'];
$password = $_POST['password'];
// Load the CRUD
require ROOT . '/justit-php-test/models/crud.php';
$register_user = new Crud();
if (isset($_POST)) {
// Start building array
$user_data = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'username' => $_POST['username'], 'password' => md5($_POST['password']));
if ($new_id = $register_user->create($user_data)) {
include 'views/register-success.php';
}
}
} else {
// Return back to the login
$this->error_message = "Please fill out the form";
$this->index();
}
}
示例2: Crud
<!DOCTYPE HTML>
<html>
<head>
<title>Create Php</title>
</head>
<body>
<?php
include_once 'model.php';
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$gender = $_POST['gender'];
$insertData = new Crud();
$insertData->create($name, $address, $phone, $gender);
header("Location: read.php");
}
?>
<form action="" method="POST">
<div>
<label>Name :</label>
<input type="text" name="name" />
</div>
<div>
<label>Address:</label>
<input type="text" name="address" />
</div>
<div>
<label>Phone:</label>
<input type="text" name="phone" />
</div>
示例3: edit
public function edit($id)
{
return Crud::create($id);
}
示例4: create
/**
* Over-rides Crud create
*
*/
public function create()
{
$this->data['pageKeys'] = $this->_pages->getStorableKeys();
return Crud::create();
}
示例5: htmlspecialchars
$codigo = htmlspecialchars($_POST['codigo']);
$descripcion = htmlspecialchars($_POST['descripcion']);
$categoria = htmlspecialchars($_POST['categoria']);
$precio = htmlspecialchars($_POST['precio']);
if (!is_numeric($precio)) {
$mensaje = "El campo precio deber ser numerico";
} elseif ($codigo == "") {
$mensaje = "Error el campo codigo es requerido!";
} elseif ($descripcion == '') {
$mensaje = "Error el campo descripcion es requerido";
} else {
$model = new Crud();
$model->insertInto = 'Productos';
$model->insertColumns = 'Codigo, Descripcion, Categoria, Precio';
$model->insertValues = "'{$codigo}','{$descripcion}', '{$categoria}', {$precio}";
$model->create();
$mensaje = $model->mensaje;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv ="content-type" content = "text/html; charset = UTF-8">
</head>
<body>
<h1>CRUD CREATE: Productos </h1>
<strong><?php
echo $mensaje;
?>
</strong>
示例6: test_create
/** @expectedException \Exception */
public function test_create()
{
/** === Call and asserts === */
$this->obj->create([]);
}