<!-- 数据新增表单 --> <form method="post" action="__URL__/insert" >
<table border="0">
<tr>
<td align="center">用户名字:</td>
<td align="center"><input type="text" name="userName"></td>
</tr>
<tr>
<td align="center">用户密码:</td>
<td align="center"><input type="text" name="passWord"></td>
</tr>
<tr>
<td align="center">加入时间:</td>
<td align="center"><input type="text" name="dateTime"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value=" 新增数据 "></td>
</tr>
</table>
// 数据写入操作 public function insert() {
$user = new UserModel(); // 实例化模型类
$list = $user->Create(); // 创建数据对象
dump($list = $user->Create());} 我在页面上输入三个值 而得到的却只有两个值
<table border="0">
<tr>
<td align="center">用户名字:</td>
<td align="center"><input type="text" name="userName"></td>
</tr>
<tr>
<td align="center">用户密码:</td>
<td align="center"><input type="text" name="passWord"></td>
</tr>
<tr>
<td align="center">加入时间:</td>
<td align="center"><input type="text" name="dateTime"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value=" 新增数据 "></td>
</tr>
</table>
// 数据写入操作 public function insert() {
$user = new UserModel(); // 实例化模型类
$list = $user->Create(); // 创建数据对象
dump($list = $user->Create());} 我在页面上输入三个值 而得到的却只有两个值
解决方案 »
- 1G的mysql数据库求搬到远程数据库的办法。
- php怎么样统计到安装ALEXA工具条访问
- 表单中插入图片问题
- 菜鸟急救!SOAP返回的XML怎么获取
- mysql语句使用疑问:count()总是返回0
- slider gallery 的使用问题
- <BUTTON class=button onclick="Run('file:///D:/GooglePinyinInstaller.exe')">QQ</BUTTON>
- 急!关于PHP中SESSION的问题
- 如何把汉字变为电子书库这样的编码?
- 我的问题解决了!!!!送分!!!
- 关于mysql数据表的小问题 大家进来看看
- !!!急,怎么获取<select>的所有option项的值
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body><!-- 数据新增表单 --> <form method="post" action="__URL__/insert" >
<table border="0">
<tr>
<td align="center">用户名字:</td>
<td align="center"><input type="text" name="userName"></td>
</tr>
<tr>
<td align="center">用户密码:</td>
<td align="center"><input type="text" name="passWord"></td>
</tr>
<tr>
<td align="center">加入时间:</td>
<td align="center"><input type="text" name="dateTime"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value=" 新增数据 "></td>
</tr>
</table></form>
</body>
</html><?php
header("Content-Type:text/html; charset=utf-8");
class UserAction extends Action{
// 数据写入操作 public function insert() {
$user = new UserModel(); // 实例化模型类
$list = $user->Create(); // 创建数据对象
dump($list = $user->Create());
}
// 数据查询操作
public function index() {
$user = new UserModel(); // 实例化模型类
$list = $user->select(); // 查询数据
$this->assign('list',$list); // 模板变量赋值
$this->display(); // 输出模板
}
}
?>UserModel 这里面什么也没写
你查看下,数据库里面是否有写入进去,看下是写入的问题,还是读出的问题。
$action->insert();
<?php
header("Content-Type:text/html; charset=utf-8");
class UserAction extends Action{// 数据写入操作 public function insert() {
$user = new UserModel(); // 实例化模型类
$list = $user->Create(); // 创建数据对象
dump($list = $user->Create());
} // 数据查询操作 public function index() {
$user = new UserModel(); // 实例化模型类
$list = $user->select(); // 查询数据
$this->assign('list',$list); // 模板变量赋值
$this->display(); // 输出模板
}
}
?>
我的方法就是写在UserAction里面的
正常的Model里面不是有东西吗 直接用就可以不是吗
<li><a href="__APP__/User/add">添加信息</a></li>
<li><a href="__APP__/User/index">查看信息</a></li>点击进入
http://hi.baidu.com/waterjiang/blog/item/0b65073adbbefbf8b311c727.html
UserModel = Model
我写错了
<input type="text" name="userName">
76 啊啊啊 啊啊啊 0000-00-00
77 请求权 请求权 0000-00-00
这是插入到数据库中的结果
$user = new UserModel(); // 实例化模型类
$date = $user->Create(); // 创建数据对象
dump($date = $user->Create());
if (!empty($date)){
if ($user->add()){
echo "添加成功!";
}else{
echo "添加失败!";
}
}else{
echo $user->getError();
}
清除Runtime->cache下的所有文件 添加数据
看下sql语句显示是什么
protected $_auto = array ();
SQL语句
$user = new UserModel(); // 实例化模型类
$date = $user->Create(); // 创建数据对象
dump($date = $user->Create());array(2) {
["userName"] => string(3) "111"
["passWord"] => string(4) "1111"
}