Home > php教程 > php手册 > 七 获取信息实例

七 获取信息实例

WBOY
Release: 2016-06-21 09:11:52
Original
1546 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";
// 以上代码最好全放在一个包含文件中


// 显示ID为3的记录的所有字段信息
$article = new Article();
$info = $article->GetInfo(3);
if (WHXBB::isError($info))
    new WHXBB_Error("读取文章信息失败,请您稍后再试", 1, WHXBB_ERROR_ECHO);
else if($info == 0)
    new WHXBB_Error("没有找到您需要的记录", 2, WHXBB_ERROR_ECHO);
else
{
    echo $info['title'];
    echo "
";
    echo "作者:" . $info['author'];
    echo "
";
    echo $info['content'];
}
@mysql_close($conn);
?>



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