• 2021.4.13


    mysqli_fetch_row();//用来将查询结果的一行保存至索引数组;

    mysqli_fetch_assoc();//用来将查询结果的一行保存至关联数组;

    mysqli_fetch_array();//前2者的结合。

    1.

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>row</title>
    </head>
    <body>
    <?php
    $conn=mysqli_connect("localhost","root","aliez0.0.","mydate1");
    if(!$conn){
    die("数据库连接失败");
    }
    echo "数据库连接成功";
    echo "<br/>";
    mysqli_query($conn,'set names utf8');

    $sql="select * from student2";
    $result=mysqli_query($conn,$sql)or die("数据查询失败");
    $row=mysqli_fetch_row($result);
    print_r($row);
    echo "<br/>";
    $row=mysqli_fetch_row($result);
    print_r($row);
    ?>
    </body>
    </html>

    2.
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>assoc</title>
    </head>
    <body>
    <?php
    $conn=mysqli_connect("localhost","root","aliez0.0.","mydate1");
    if(!$conn){
    die("数据库连接失败");
    }
    echo "数据库连接成功";
    echo "<br/>";
    mysqli_query($conn,'set names utf8');

    $sql="select * from student2";
    $result=mysqli_query($conn,$sql)or die("数据查询失败");
    $row=mysqli_fetch_assoc($result);
    print_r($row);
    echo "<br/>";
    $row=mysqli_fetch_assoc($result);
    print_r($row);
    ?>
    </body>
    </html>

    3.
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>array</title>
    </head>
    <body>
    <?php
    $conn=mysqli_connect("localhost","root","aliez0.0.","mydate1");
    if(!$conn){
    die("数据库连接失败");
    }
    echo "数据库连接成功";
    echo "<br/>";
    mysqli_query($conn,'set names utf8');

    $sql="select * from student2";
    $result=mysqli_query($conn,$sql)or die("数据查询失败");

    $row=mysqli_fetch_array($result);

    print_r($row);

    echo "<br/>";

    $row=mysqli_fetch_array($result);

    print_r($row);
    ?>
    </body>
    </html>
  • 相关阅读:
    决策树
    Caffe:深入分析(怎么训练)
    Caffe深度学习计算框架
    Caffe参数交换源码分析
    Net的网络层的构建(源码分析)
    FineTuning机制的分析
    Caffe::Snapshot的运行过程
    AdaBoost算法
    SVM支持向量机
    SMO序列最小最优化算法
  • 原文地址:https://www.cnblogs.com/SirNie/p/14655988.html
Copyright © 2020-2023  润新知