zoukankan      html  css  js  c++  java
  • mysqli和mysql的三种单条信息查询方式实例

    这是mysqli面向对象方法

    $db=new mysqli('localhost','root','','test');
    $db->set_charset("utf8");
    $uid=$_GET['id'];
    $sql="select * from gh where id = 3";
    $se=$db->query($sql);
    $se=$se->fetch_array();
    var_dump($se);

    mysqli面向过程方法

    $db=mysqli_connect('localhost','root','','test');
    mysqli_set_charset($db,"utf8");
    $se=mysqli_query($db,"select * from gh where id = 3");
    $se=mysqli_fetch_array($se);

    mysql链接数据库查询方法
    $conn=mysql_connect("localhost","root","");
    mysql_select_db('test');
    mysql_query("set names 'utf8'");
    $se=mysql_query("select * from gh where id = 3");
    $se=mysql_fetch_array($se);

  • 相关阅读:
    API
    API
    for in
    event flow
    object
    Report of program history
    正则表达式
    伪类与伪元素
    Position
    js学习之原型(补充)
  • 原文地址:https://www.cnblogs.com/zhanghao1314/p/4950233.html
Copyright © 2011-2022 走看看