只需要确保php.ini配置文件中的;extension=mysql.dll前面的;是去掉的,因为这是注释符号然后你就可以一步步进行mysql操作了1、连接数据库
2、定义SQL语句
3、获取数据
4、按一定方式输出
5、关闭连接具体你看一下php手册中关于mysql的介绍,这个不难,自己钻研就行手册你可以在CSDN上下

解决方案 »

  1.   

    <?php
    @$db=new mysqli("localhost","root","","tour");
    if(mysqli_connect_errno()){
       echo '数据库连接错误';
       exit;
    }
    session_start();
    if(isset($_POST['fuser'])&&isset($_POST['fpwd'])){
    if(!get_magic_quotes_gpc()){  //测试系统是否自动完成转义
       $fuser=addslashes($_POST['fuser']);  //转义字符串
       $fpwd=addslashes($_POST['fpwd']);
    }
    $query="select * from aduser where id='".$fuser."' and password='".$fpwd."'";
    $result=$db->query($query);
    $rows=$result->num_rows;
    if(!empty($rows)){
    $_SESSION["uid"]=$_POST['fuser'];
    $_SESSION["pwd"]=$_POST['fpwd'];
    header("location:index.php");
       exit();
    }else{
    ?>
    <script language="javascript">
    alert("用户名或密码错误");
    </script>
    <?php
    }
    }
    ?>
    <html>
    <body>
    <form name="login" action="login.php" method="post" onsubmit="return check();">
    <table align="center" width="330" border="1">
    <tr><th width="100%" colspan="2">后 台 登 陆</th></tr>
    <tr><td width="30%">用户名:</td>
    <td width="70%"><input type="text" name="fuser" size="26"></td></tr>
    <tr><td>密&nbsp&nbsp码:</td>
    <td><input type="password" name="fpwd" size="29"></td></tr>
    <tr><td colspan="2" ><input type="submit" value="  登  陆  "></td></tr>
    </table>
    </form>
    </body>
    </html>