• 每日总结


    1.php大作业 完成了个人订单查询

    <?php

    $page=1;
    $name=null;
    if(!empty($_GET)) {
    if(isset($_GET["message"]))
    {
    $message = $_GET["message"];
    echo "<script>alert('$message');</script>";

    }



    if(isset($_GET["page"]))
    {
    $page=$_GET["page"];
    }
    else
    {
    $page=1;
    }

    if (!session_id()) session_start();
    if(isset($_SESSION["type"]))
    {
    if($_SESSION["type"]==0)
    {
    header("location:goodlist.php?message=NotRegister!&page=$page");
    return;
    }
    else
    {
    $name=$_SESSION["name"];
    }

    }
    else
    {
    header("location:goodlist.php?message=NotRegister!&page=$page");
    return;
    }
    }

    ?>
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>个人订单查看</title>
    </head>
    <body style="text-align:center;">
    <h1>个人订单查看</h1>
    <br/>
    <br/>
    <table align="center" border="1" cellspacing="0" style="50%;">
    <tr>
    <th style="background:yellow;">订单号</th>
    <th style="background:yellow;">收货人</th>
    <th style="background:yellow;">收货人地址</th>
    <th style="background:yellow;">商品id</th>
    <th style="background:yellow;">商品数量</th>
    <th style="background:yellow;">订单金额</th>
    <th style="background:yellow;">手机号</th>
    <th style="background:yellow;">商品名称</th>
    <th style="background:yellow;">是否完成</th>
    </tr>
    <?php
    //连接数据库
    //判断连接成功
    //选择数据库
    //设置字符集
    //准备sql语句
    //发送sql语句
    //处理数据
    //关闭数据库连接
    //连接数据库
    $link=mysqli_connect("","","");
    //判断连接成功
    if(!$link)
    {
    echo '连接失败';
    //return;
    }
    //选择数据库
    mysqli_select_db($link,"");
    //设置字符集
    mysqli_set_charset($link,'utf8');
    //准备sql语句
    if (!session_id()) session_start();
    if(!isset($_SESSION["name"]))
    {
    header("location:goodlist.php?message=NotRegister!&page=$page");
    return;
    }
    $sql="select * from userbill where name='".$_SESSION["name"]."'";
    //发送sql语句
    $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/>";
    while($attr=mysqli_fetch_array($result))
    {
    ?>
    <!-- showType网页-->

    <tr>
    <td><?php echo $attr[0]; ?></td>
    <td><?php echo $attr[2]; ?></td>
    <td><?php echo $attr[3]; ?></td>
    <td><?php echo $attr[4]; ?></td>
    <td><?php echo $attr[5]; ?></td>
    <td><?php echo $attr[6]; ?></td>
    <td><?php echo $attr[8]; ?></td>
    <td><?php echo $attr[9]; ?></td>
    <td><?php if($attr[7]==1)echo '完成';else echo '未完成'; ?></td> </
    tr>

    <?php
    }
    }
    //关闭数据库连接
    mysqli_close($link);
    ?>

    </
    table><
    br/><
    hr><
    span> ©版权所有:石家庄铁道大学信息科学与技术学院 </span></

    body></
    html>
  • 相关阅读:
    php正则表达式验证(邮件地址、Url地址、电话号码、邮政编码)
    laravel 事件广播
    windows apache 配置多个服务 站点 Apache Service Monitor
    apache配置多站点
    querySelector和querySelectorAll方法介绍
    document.domain与js跨域的问题
    用JS判断用户使用的是手机端还是pc端访问
    下载的firebug-lite压缩包的调用方法
    JS实现常用的分享到按钮
    转:不会定义jQuery插件,不要说会jQuery
  • 原文地址:https://www.cnblogs.com/chenghaixiang/p/14914472.html
Copyright © 2020-2023  润新知