zoukankan      html  css  js  c++  java
  • 每日总结

    1.今天学习php与mysql的连接

    
    
    $link=mysqli_connect("localhost","root","123456");
    if(!$link)
    {
    echo '连接失败';
    }
    mysqli_select_db($link,"goodlist");

    mysqli_set_charset($link,'UTF-8');

    $sql="select * from User";

    $result=mysqli_query($link,$sql);
    //处理数据
    if($result)
    {
    //fetch_row获取行的数据
    //mysqli_detch_assoc获取对应键值,$attr['linenum']可获取数据
    //获取字段数
    //echo mysqli_num_fields($result),"<br/>";
    //获取信息数
    //echo mysqli_num_rows($result),"<br/>";
    $g_having=false;
    while($attr=mysqli_fetch_array($result))
    {
    if($attr[0]==$name)
    {
    $g_having=true;
    if($attr[1]==$password)
    {
    $_SESSION["name"]=$name;
    $_SESSION["type"]=$attr[2];
    header("location:showgood.php");
    }
    else{
    header("location:index.php?message=WrongPassword!");
    }
    }

    }
    if(!$g_having)
    {
    header("location:index.php?message=WrongUsername!");
    }
    }
    //关闭数据库连接
    mysqli_close($link);


    }else{
    header("location:index.php?message=CaptchaError!");
    }
    }
    
    
  • 相关阅读:
    ios获取iphone手机设备型号
    iOS项目中所有icon的尺寸以及命名
    c++达内视频
    ffmpeg教程
    FFMPEG SDK 教程
    minicom 下载
    线程同步的几种方法的总结
    多线程笔试面试概念问答
    buntu Rhythmbox解决中文乱码
    菜鸟学习ios
  • 原文地址:https://www.cnblogs.com/chenghaixiang/p/14914250.html
Copyright © 2011-2022 走看看