1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

请大家看看这段PHP代码哪错?

本帖由 leehui19832006-09-15 发布。版面名称:后端开发

  1. leehui1983

    leehui1983 New Member

    注册:
    2006-02-26
    帖子:
    130
    赞:
    0
    服务器配置没有问题,本人用的是PHP5,运行后信息没写进数据库,画面没有任何输出,请大家看看怎么回事?
    <?php

    @ $db=new mysqli('localhost','root','myoa888','demo');
    if (mysqli_connect_errno())
    {
    echo 'Error: Could not connect to database. Please try again later.';
    exit;
    }
    $data1="ok";
    $data2="ok2";
    $sql="insert into [data] values ('".$data1."','".$data2."')";
    $result=$db->query($sql);

    echo "<html>\n";
    echo"<head>\n";
    echo"<title>ok</title>\n";
    echo"</head>\n";
    echo"<body>";
    echo"ok\n";
    echo"</body>\n";
    echo"</html>";
    $db->close;
    ?>