数据库数据模型
使用方法
构造一个数据库表模型
$beian=M('beian');
自动填充aaa bbb字段 $_POST中也要有这两个字段
//$beian->create(array("aaa","bbbb"));
$data中填充
$beian->create($data,array("aaa","bbbb"));
取两个主键值,排序为升序
//print_r($beian->get(53,54,'asc'));
赋值给字段。
$beian->userid=2;
$beian->language=1;
$beian->setUserid(55);//使用函数方式,防止出错
$beian->setLanguage("US");
直接POST入库 映射操作例子:
$gbook=M("gbook")->create("fix",array("content"=>"comment"))->save();
content 是数据库字段
comment是$_POST字段 key 这样允许提交不同的值进来
打印已经赋值字段
//print_r($beian->data);
保存,再显示刚才插入的ID
//echo $beian->save()->pkid();
设置主键然后删除
//echo($beian->pkid(69)->delete())
本文链接http://www.cxybl.com/html/wlbc/Php/20130326/37400.html
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn