Home > php教程 > php手册 > 六 插入实例

六 插入实例

WBOY
Release: 2016-06-21 09:11:51
Original
1335 people have browsed it

插入


$conn = @mysql_connect('localhost:3306','test','test');
include_once "js.class.php";
include_once "pager.class.php";
include_once "whxbb.class.php";
include_once "whxbb_article.class.php";
// 以上代码最好全放在一个包含文件中

$article = new WHXBB_Article();
$result = $artcile->Insert('今日天气', 'whxbb', '今天北京局部地区有雨');

// 如果出错,弹出错误信息并返回上页(录入页面)
if (WHXBB::isError($result)) {
    new WHXBB_Error("错误:" . $result->GetMsg() . "(" . $result->GetNo . ")", 1, WHXBB_ERROR_ALERT + WHXBB_ERROR_RETURN);
    // 或者如下自定义错误
    //new WHXBB_Error("添加失败,请您稍后再试", 1, WHXBB_ERROR_ALERT + WHXBB_ERROR_RETURN);
}
else
{
    JS::Alert("添加成功");
    // 跳到指定页
    JS:Goto("add.php");
}
?>



Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template