search
Homephp教程php手册数据模型:PHP框架queryphp教程:入门四 ORM数据模型内容添加


数据库数据模型
使用方法
构造一个数据库表模型
$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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment