• 吴裕雄--天生自然 PHP开发学习:MySQL子句


    <?php
    $con=mysqli_connect("localhost","username","password","database");
    // 检测连接
    if (mysqli_connect_errno())
    {
        echo "连接失败: " . mysqli_connect_error();
    }
    
    $result = mysqli_query($con,"SELECT * FROM Persons ORDER BY age");
    
    while($row = mysqli_fetch_array($result))
    {
        echo $row['FirstName'];
        echo " " . $row['LastName'];
        echo " " . $row['Age'];
        echo "<br>";
    }
    
    mysqli_close($con);
    ?>
    <?php
    $con=mysqli_connect("localhost","username","password","database");
    // 检测连接
    if (mysqli_connect_errno())
    {
        echo "连接失败: " . mysqli_connect_error();
    }
    
    $result = mysqli_query($con,"SELECT * FROM Persons
    WHERE FirstName='Peter'");
    
    while($row = mysqli_fetch_array($result))
    {
        echo $row['FirstName'] . " " . $row['LastName'];
        echo "<br>";
    }
    ?>
    <?php
    $con=mysqli_connect("localhost","username","password","database");
    // 检测连接
    if (mysqli_connect_errno())
    {
        echo "连接失败: " . mysqli_connect_error();
    }
    
    mysqli_query($con,"UPDATE Persons SET Age=36
    WHERE FirstName='Peter' AND LastName='Griffin'");
    
    mysqli_close($con);
    ?>
    <?php
    $con=mysqli_connect("localhost","username","password","database");
    // 检测连接
    if (mysqli_connect_errno())
    {
        echo "连接失败: " . mysqli_connect_error();
    }
    
    mysqli_query($con,"DELETE FROM Persons WHERE LastName='Griffin'");
    
    mysqli_close($con);
    ?>
  • 相关阅读:
    XML解析
    异步网络请求和JOSN解析
    iOS iOS8新特性-UIAlertController
    iOS8新特性 UIPresentationController(一)
    iOS沙盒(sandbox)机制及获取沙盒路径
    iOS学习之iOS沙盒(sandbox)机制和文件操作(一)
    IOS沙盒机制(SandBox)
    手势(转)
    //快速添加一个视图控制器
    iOS开发常用的网站(转老师的)
  • 原文地址:https://www.cnblogs.com/tszr/p/10955787.html
Copyright © 2020-2023  润新知