• mysql 基础


    <?php
    $mysql_conf = array(
    'host' => 'localhost',
    'db' => 'zhijin',
    'db_user' => 'root',
    'db_pwd' => '',
    );
    $mysql_conn = @mysql_connect($mysql_conf['host'], $mysql_conf['db_user'], $mysql_conf['db_pwd']);
    if (!$mysql_conn) {
    die("could not connect to the database: " . mysql_error());//诊断连接错误
    }
    mysql_query("set names 'utf8'");//编码转化
    $select_db = mysql_select_db($mysql_conf['db']);
    if (!$select_db) {
    die("could not connect to the db: " . mysql_error());
    }
    $sql = "select * from article;";
    $res = mysql_query($sql);
    if (!$res) {
    die("could get the res: " . mysql_error());
    }

    while ($row = mysql_fetch_assoc($res)) {
    // print_r($row);
    }

    // var_dump($_POST);
    $username = $_POST['username'];
    $password = $_POST['pwd'];
    $sql = "select * from admin where username='$username' and password = '$password'";
    $str = mysql_query($sql);
    $str = mysql_fetch_row($str);
    if(empty($str)){
    $url = 'http://localhost/index.html';
    echo "<script type='text/javascript'>window.location.href='$url';alert('账号或密码输入错误')</script>";
    // alert(账号或密码输入错误);
    }else{
    var_dump($str);

    }


    ?>

  • 相关阅读:
    kubernetes(七)二进制安装-worker节点安装
    kubernetes(六)二进制安装-master节点安装
    B树
    Nginx反向代理无法达到效果原因
    AVL树
    平衡二叉搜索树
    二叉搜索树
    二叉树
    js-day06-jQuery事件和DOM操作-练习题
    js-day05-JSON-jQuery初体验
  • 原文地址:https://www.cnblogs.com/vip-deng-vip/p/8036905.html
Copyright © 2020-2023  润新知