📄 phpclasstemplate.php
字号:
<?php
/*
* 问题类型
*/
class webquestiontype {
//*****声明表字段*****
var $TABLE_NAME;
var $QUESTION_TYPE_ID_FD;
var $TYPENAME_FD;
var $ISSHOW_FD;
var $PARENT_ID_FD;
//*****声明表字段结束*****
//*****声明成员*****
//问题类型编号
var $questionTypeId;
//类型名称
var $typeName;
//父类编号
var $parentId;
//是否显示
var $isShow;
//*****声明成员结束*****
/*
* 构造函数
*/
function webquestiontype()
{
$this->TABLE_NAME = "WEB_QuestionType";
$this->QUESTION_TYPE_ID_FD = "QuestionTypeID";
$this->TYPENAME_FD = "TypeName";
$this->PARENT_ID_FD = "ParentID";
$this->ISSHOW_FD = "IsShow";
}
/*
* 设置问题类型数据
*/
function set_data($questionTypeId,$typeName,$parentId,$isShow)
{
$this->questionTypeId = $questionTypeId;
$this->typeName = $typeName;
$this->parentId = $parentId;
$this->isShow = $isShow;
}
/*
* 得到所有的问题类型
*/
function get_all()
{
$result = mysql_query("select * from ".$this->TABLE_NAME);
return $result;
}
/*
*根据问题类型编号得到相关的问题类型
*/
function get_by_questiotnTypeId($questionTypeId)
{
$sql = "select * from ".$this->TABLE_NAME
." where ".$this->QUESTION_TYPE_ID_FD."=".$questionTypeId;
$result = mysql_query($sql);
return $result;
}
/*
* 插入问题类型
*/
function insert()
{
$sql = "insert into ".$this->TABLE_NAME
."("
.$this->TYPENAME_FD
.",".$this->PARENT_ID_FD
.",".$this->ISSHOW_FD
.")values("
."'".$this->typeName."'"
.",".$this->parentId
.",".$this->isShow
.")";
mysql_query($sql);
}
/*
* 根据问题类型编号修改问题类型
*/
function update($questionTypeId)
{
$sql = "update ".$this->TABLE_NAME
." set "
//.$this->QUESTION_TYPE_ID_FD."=".$this->questionTypeId
.$this->TYPENAME_FD."='".$this->typeName."',"
.$this->PARENT_ID_FD."=".$this->parentId.","
.$this->ISSHOW_FD."=".$this->isShow
." where ".$this->QUESTION_TYPE_ID_FD."=".$questionTypeId;
mysql_query($sql);
}
/*
* 根据问题类型编号删除问题类型
*/
function delete($questionTypeId)
{
$sql = "delete from ".$this->TABLE_NAME
." where QuestionTypeId=".$questionTypeId;
mysql_query($sql);
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -