当前位置: 首页>>代码示例>>PHP>>正文


PHP Crud::create方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:acutedeveloper,项目名称:justit-php-test,代码行数:21,代码来源:register.php

示例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>
开发者ID:ocpyosep78,项目名称:basicCrudInPhp,代码行数:31,代码来源:create.php

示例3: edit

 public function edit($id)
 {
     return Crud::create($id);
 }
开发者ID:csgt,项目名称:components,代码行数:4,代码来源:crudController.php

示例4: create

 /**
  * Over-rides Crud create
  *
  */
 public function create()
 {
     $this->data['pageKeys'] = $this->_pages->getStorableKeys();
     return Crud::create();
 }
开发者ID:cybercog,项目名称:exambuff,代码行数:9,代码来源:script.php

示例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>
开发者ID:avillapena,项目名称:curso-php,代码行数:31,代码来源:crear.php

示例6: test_create

 /** @expectedException \Exception */
 public function test_create()
 {
     /** === Call and asserts  === */
     $this->obj->create([]);
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_core,代码行数:6,代码来源:Crud_Test.php


注:本文中的Crud::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。