深圳大学数据库系统实验 Leasing Luxury Database system 基于PHP,MySQL,Web三件套

2023-11-15

本实验要求搭建一个手袋租聘的数据库系统,并实现以下要求:

  1. 创建一个数据库,可以记录客户数据,手袋数据,租聘数据,设计者数据
  2. 用户可以提供自己的邮箱地址,邮寄地址,信用卡号码,来注册租聘网站
  3. 数据库要展示所有课租聘的手袋,已被租聘的手袋用户不能租聘,用户可以在网站上通过填写相关信息来租聘手袋,设计一个存储过程能记录租聘信息
  4. 写一个储存过程,用户可以通过搜索设计师的名字来查询手袋,输入设计师的名字,能列出袋子的名字和它的颜色
  5. 写一个储存过程,计算出每个客户保管包的时间,按最长时间到最短时间进行排序
  6. 写一个储存过程,计算并列出每个客户的消费金额。 这些金额将反映出这个包已经租了多少天
  7. 写一个存储过程,实现手袋表的信息添加
  8. 写一个存储过程,展示客户名下租了未还的手袋
  9. 利用触发器,实现手袋退回并能重新出租,同时打印出租的总时长和总金额
    显示友好的异常输入提示和友好的web交互界面

1.创建一个名为final的数据库,搭建五个数据表

在这里插入图片描述

整体搭建思路和模型如下,记录客户数据,手袋数据,租聘数据,设计者数据:

在这里插入图片描述

同时撰写conn.php文件链接php和数据库系统:

<?php
$hostname = "localhost"; //主机名,可以用IP代替
$database = "final"; //数据库名
$username = "root"; //数据库用户名
$password = ""; //数据库密码
$conn = mysqli_connect($hostname, $username, $password) or trigger_error(mysqli_error($conn), E_USER_ERROR);
mysqli_select_db($conn, $database);
$db = @mysqli_select_db($conn, $database) or die(mysqli_error($conn));

2.搭建用户注册和登录界面:

注册界面,用户输入邮箱,地址,信用卡号,电话,姓名,密码,完成注册:
在这里插入图片描述

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>主页</title>
    <style>
        body {
            background-color: whitesmoke;
        }

        .title p {
            font-size: 30px;
            background-color: whitesmoke;
            text-transform: capitalize;
            text-align: center;
            border-bottom: 5px solid black;

        }

        .title {
            width: 500px;
            text-align: center;
            margin: auto;
        }

        .firstrow {
            text-transform: capitalize;
        }

        a:link {
            color: blue;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        a:visited {
            color: black;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        table {
            text-align: left;

            background-color: whitesmoke;
            border-radius: 5px;

            border-spacing: 10px;
            margin: auto;
        }

        td,
        th {
            min-width: 100px;
            border-bottom: 1px solid gray;
            margin-left: 10px;
        }

        .insert {
            text-align: center;
            background-color: black;
        }

        .back {
            background-color: whitesmoke;
        }

        .search {
            margin: auto;
            text-align: center;
        }

        .button {
            background: whitesmoke;
        }

        input {
            background-color: whitesmoke;
            border-color: whitesmoke;
        }
    </style>
</head>

<body>
    <div>
        <div class='back'>
            <div class='title'>
                <p>Add new bag</p>
            </div>
            <div class='neirong'>
                <form class='search' action="login.php" method="post">
                    <table>
                        <tr>
                            <td>Email</td>
                            <td><input type="text" name="email"></td>
                        </tr>
                        <tr>
                            <td>Address</td>
                            <td><input type="text" name="address"></td>
                        </tr>
                        <tr>
                            <td>Credit Card</td>
                            <td><input type="text" name="credit"></td>
                        </tr>
                        <tr>
                            <td>Phone</td>
                            <td><input type="text" name="phone"></td>
                        </tr>
                        <tr>
                            <td>Last Name</td>
                            <td><input type="text" name="ln"></td>
                        </tr>
                        <tr>
                            <td>First Name</td>
                            <td><input type="text" name="fn"></td>
                        </tr>
                        <tr>
                            <td>Password</td>
                            <td><input type="text" name="password"></td>
                        </tr>
                        <tr>
                            <td colspan='2' style='text-align:center;'><input class='button' type="submit" value="login" name="submit"></td>
                        </tr>

                    </table>
                </form>
            </div>
        </div>
</body>
</html>

登录界面,用户可以通过邮箱和密码,登录系统

<?php
error_reporting(0);
$email = $_POST['email'];
if ($email) {
    include("conn.php");
    mysqli_query($conn, "set names gb2312");
    error_reporting(0);
    $email = $_POST['email'];
    $address = $_POST['address'];
    $credit = $_POST['credit'];
    $phone = $_POST['phone'];
    $fn = $_POST['fn'];
    $ln = $_POST['ln'];

    $sql = "select cid from customer";
    $res = mysqli_query($conn, $sql);
    $rows = mysqli_num_rows($res);
    $cid = 101 + $rows;

    $sql = "insert into customer(`cid`, `phone`, `address`, `email`, `card`, `first_name`, `last_name`) VALUES ($cid,$phone,'$address','$email',$credit,'$ln','$fn')";
    $res = mysqli_query($conn, $sql);
    if ($res)
        echo "<script language=javascript>window.alert('register sccessfully,please login')</script>";
    else
        echo "<script language=javascript>window.alert('register fail,please return');history.go(-1)</script>";
}
?>

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>主页</title>
    <style>
        body {
            background-color: whitesmoke;
        }

        .title p {
            font-size: 30px;
            background-color: whitesmoke;
            text-transform: capitalize;
            text-align: center;
            border-bottom: 5px solid black;

        }

        .title {
            width: 500px;
            text-align: center;
            margin: auto;
        }

        .firstrow {
            text-transform: capitalize;
        }

        a:link {
            color: blue;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        a:visited {
            color: black;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        table {
            text-align: left;

            background-color: whitesmoke;
            border-radius: 5px;

            border-spacing: 10px;
            margin: auto;
        }

        td,
        th {
            min-width: 100px;
            border-bottom: 1px solid gray;
            margin-left: 10px;
        }

        .insert {
            text-align: center;
            background-color: black;
        }

        .back {
            background-color: whitesmoke;
        }

        .search {
            margin: auto;
            text-align: center;
        }

        .button {
            background: whitesmoke;
        }

        input {
            background-color: whitesmoke;
            border-color: whitesmoke;
        }
    </style>
</head>

<body>
    <div>
        <div class='back'>
            <div class='title'>
                <p>Login</p>
            </div>
            <div class='neirong'>
                <form class='search' action="show.php" method="post">
                    <table>
                        <tr>
                            <td>Email</td>
                            <td><input type="text" name="email" placeholder="belle@comcast.net"></td>
                        </tr>
                        <tr>
                            <td>Password</td>
                            <td><input type="password" name="bcolor"></td>
                        </tr>
                        <tr>
                            <td colspan='2' style='text-align:center;'><input class='button' type="submit" value="login" name="submit"></td>
                        </tr>
                    </table>
            </div>
        </div>
</body>
</html>

3.数据库要展示所有课租聘的手袋,已被租聘的手袋用户不能租聘,用户可以在网站上通过填写相关信息来租聘手袋,设计两个存储过程能记录租聘信息和实现手袋状态的更新:

设计一个存储过程,完成租聘信息在数据表rental的录入

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `add_rental`(IN `id` INT(32), IN `customerId` INT(32), IN `bagId` INT(32), IN `optionalInsurance` TINYINT(1), IN `daysOfRent` INT(10))
insert into rental(rid,cid, bid, date_rented, date_returned, optional_insurance) 
    values (id,customerId, bagId, curdate(), curdate() + daysOfRent, optionalInsurance)$$
DELIMITER ;

再设计一个存储过程,更新手袋状态为不可租聘状态

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `update_rentals`(bagId int(32))
update bag set already_rented = 1 where bid = bagId$$
DELIMITER ;

界面展示了所有可以租聘的手袋,用户可以通过点击Rent进入租聘界面,已被租聘的手袋会显示“Can’t Rental”而无法租聘:

在这里插入图片描述

<?php
error_reporting(0);
$email = $_POST['email'];
if ($email) {
    include("conn.php");
    mysqli_query($conn, "set names gb2312");
    $sql = "SELECT cid FROM customer WHERE email='$email';";
    $res = mysqli_query($conn, $sql);
    $data = mysqli_fetch_array($res);
    session_start();
    $_SESSION['cid'] = $data[0];
}
?>
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>主页</title>
    <style>
        body {
            background-color: whitesmoke;
        }

        .title p {
            font-size: 30px;
            background-color: whitesmoke;
            text-transform: capitalize;
            text-align: left;
            border-left: 5px solid black;
            padding-left: 10px;
        }

        .title {
            width: 500px;
        }

        .firstrow {
            text-transform: capitalize;
        }

        a:link {
            color: blue;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        a:visited {
            color: black;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        table {
            text-align: left;

            background-color: whitesmoke;
            border-radius: 5px;
            width: 1000px;
            border-top: 10px solid black;
            border-spacing: 10px;
            margin-left: 10px;
        }

        td,
        th {
            min-width: 100px;
            border-bottom: 1px solid gray;
            margin-left: 10px;
        }

        .insert {
            text-align: center;
            background-color: black;
        }

        .back {
            background-color: whitesmoke;
        }

        .search {

            margin-left: 10px;
            ;
        }

        .button {
            background: whitesmoke;
        }

        .neirong {
            margin-bottom: 40px;
        }

        .neirong p {
            margin-left: 10px;
        }

        aside.NavSidebar {
            padding: 5px 15px 5px 15px;
            width: 203px;
            background-color: whitesmoke;
            font-size: small;
            float: left;
            margin-right: 10px;
        }

        aside.NavSidebar h2 {
            color: black;
            border-bottom: thin black solid;
            margin-bottom: 10px;
            margin-top: 20px;
        }

        aside.NavSidebar ul {
            padding-left: 15px;
        }

        aside.NavSidebar li {
            padding-bottom: 8px;
        }

        .main {
            float: left;
        }

        .bbb {
            background-color: whitesmoke;
        }

        .ccc {
            text-align: center;
        }
    </style>
</head>

<body>
    <script>
        window.history.replaceState(null, null, window.location.href);
    </script>
    <aside class="NavSidebar">
        <nav>
            <h2>LL Company</h2>
            <ul>
                <li><a href="/final/Show">Rent</a> </li>
                <li><a href="/final/add">Add</a> </li>
                <li><a href="/final/bill">Bill</a> </li>
                <li><a href="/final/bag_by_designer">Search</a></li>
                <li><a href="/final/best_customers">Customers</a></li>
                <li><a href="/final/mybag">My bag</a></li>
            </ul>
        </nav>
    </aside>
    <div class='main'>
        <div class='back'>
            <div class='title'>
                <p>Bag List</p>
            </div>
            <div class='neirong'>

                <?php
                include("conn.php");
                mysqli_query($conn, "set names gb2312");

                $sql = "select bid,btype,color,already_rented from bag";
                $res = mysqli_query($conn, $sql);
                $rows = mysqli_num_rows($res);

                if ($rows) {
                    echo '</div>';
                    $field = mysqli_num_fields($res);

                    echo '<table class="table">';
                    echo '<thead><tr>';
                    echo '<th>Bag ID</th><th>Name</th><th>Color</th><th class="ccc">Condition</th>';
                    echo '</tr></thead>';

                    echo '<tbody>';

                    for ($i = 1; $i <= $rows; $i++) {

                        $data = mysqli_fetch_array($res);
                        for ($j = 0; $j < $field - 1; $j++) {
                            echo "<td>$data[$j]</td>";
                        }
                        if ($data[$field - 1] == 0) {
                            echo "<td class='ccc'><form action='rent.php' method='post'><input type='hidden' name='bid' value='$data[0]'><input class='bbb' type ='submit' name='submit' value='Rent'></form></td>";
                            echo '</tr>';
                        } else {
                            echo "<td class='ccc'>Can't Rental</td>";
                            echo '</tr>';
                        }
                    }
                    echo '</tbody></table>';
                }

                ?>
            </div>
        </div>
</body>

</html>

用户可以选择是否购买保险服务和租聘的天数:

在这里插入图片描述

租聘成功会弹出提示框,点击确定会自动返回所有手袋的页面:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-v6555E5E-1672286298674)(C:\Users\Nathan\AppData\Roaming\Typora\typora-user-images\image-20221228115836371.png)]

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>主页</title>
    <style>
        body {
            background-color: whitesmoke;
        }

        .title p {
            font-size: 30px;
            background-color: whitesmoke;
            text-transform: capitalize;
            text-align: center;
            border-bottom: 5px solid black;

        }

        .title {
            width: 500px;
            text-align: center;
            margin: auto;
        }

        .firstrow {
            text-transform: capitalize;
        }

        a:link {
            color: blue;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        table {
            text-align: left;

            background-color: whitesmoke;
            border-radius: 5px;

            border-spacing: 10px;
            margin: auto;
        }

        td,
        th {
            min-width: 100px;
            border-bottom: 1px solid gray;
            margin-left: 10px;
        }

        .insert {
            text-align: center;
            background-color: black;
        }

        .back {
            background-color: whitesmoke;
            margin: 100px;
        }

        .search {
            margin: auto;
            text-align: center;
        }

        .button {
            background: whitesmoke;
        }

        input {
            background-color: whitesmoke;
            border-color: whitesmoke;
        }

        select {
            width: 170px;
            background-color: whitesmoke;
        }
    </style>
</head>

<?php
error_reporting(0);
$bid = $_POST['bid'];
?>


<body>
    <div class='back'>
        <div class='title'>
            <p>Rent Bag</p>
        </div>
        <div class='neirong'>
            <form class='search' action="rent.php" method="post">
                <input type="hidden" name="bid" value="<?php echo $bid; ?>" />
                <table>
                    <tr>
                        <td>Do you need insurance?</td>
                        <td>
                            <select name="insurance">
                                <option value="1">Yes</option>
                                <option value="0">No</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>Rent date</td>
                        <td><input type="text" name="day"></td>
                    </tr>
                    <tr>
                        <td colspan='2' style='text-align:center;'><input class='button' type="submit" value="Rent" name="submit1"></td>
                    </tr>

                </table>
            </form>

            <?php

            include("conn.php");
            mysqli_query($conn, "set names gb2312");
            error_reporting(0);
            session_start();
            $cid = $_SESSION['cid'];
            $bid = $_POST['bid'];
            $insurance = $_POST['insurance'];
            $day = $_POST['day'];

            $sql = "select rid from rental";
            $res = mysqli_query($conn, $sql);
            $rows = mysqli_num_rows($res);
            $id = 1 + $rows;

            if (isset($_POST['submit1'])) {
                $sql = "call add_rental($id,$cid,$bid,$insurance,$day)";
                $res = mysqli_query($conn, $sql);

                mysqli_close($conn);
                include("conn.php");
                mysqli_query($conn, "set names gb2312");
                $sql = "call update_rentals($bid)";
                $res = mysqli_query($conn, $sql);

                if ($res)
                    echo "<script language=javascript>window.alert('rent sccessfully,please return');history.go(-2);window.history.replaceState(null, null, window.location.href);</script>";
                else
                    echo "<script language=javascript>window.alert('rent fail,please return');history.go(-2);window.history.replaceState(null, null, window.location.href);</script>";
            }

            ?>

        </div>
</body>

</html>

4.用户输入设计师的名字,能列出袋子的名字和它的颜色:

设计一个存储过程:

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `bag_by_designer`(in designer varchar(30))
select 
        btype as 'Name', 
        color as 'Color', 
        d.name as 'Manufacturer' 
    from bag as b
    left join designer as d
    on b.did = d.did
    where d.name = designer$$
DELIMITER ;

用户输入设计师名字可以实现查询该设计师名下的所有手袋:

在这里插入图片描述

以及友好的错误输入提示
在这里插入图片描述

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>主页</title>
    <style>
        body {
            background-color: whitesmoke;
        }

        .title p {
            font-size: 30px;
            background-color: whitesmoke;
            text-transform: capitalize;
            text-align: left;
            border-left: 5px solid black;
            padding-left: 10px;
        }

        .title {
            width: 500px;
        }

        .firstrow {
            text-transform: capitalize;
        }

        a:link {
            color: blue;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        a:visited {
            color: black;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        table {
            text-align: left;

            background-color: whitesmoke;
            border-radius: 5px;
            width: 1000px;
            border-top: 10px solid black;
            border-spacing: 10px;
            margin-left: 10px;
        }

        td,
        th {
            min-width: 100px;
            border-bottom: 1px solid gray;
            margin-left: 10px;
        }

        .insert {
            text-align: center;
            background-color: black;
        }

        .back {
            background-color: whitesmoke;
        }

        .main {
            float: left;
        }

        .search {

            margin-left: 10px;
            ;
        }

        .button {
            background: whitesmoke;
        }

        .neirong {
            margin-bottom: 40px;
        }

        .neirong p {
            margin-left: 10px;
        }

        aside.NavSidebar {
            padding: 5px 15px 5px 15px;
            width: 203px;
            background-color: whitesmoke;
            font-size: small;
            float: left;
            margin-right: 10px;
        }

        aside.NavSidebar h2 {
            color: black;
            border-bottom: thin black solid;
            margin-bottom: 10px;
            margin-top: 20px;
        }

        aside.NavSidebar ul {
            padding-left: 15px;
        }

        aside.NavSidebar li {
            padding-bottom: 8px;
        }
    </style>
</head>

<body>
    <aside class="NavSidebar">
        <nav>
            <h2>LL Company</h2>
            <ul>
                <li><a href="/final/Show">Rent</a> </li>
                <li><a href="/final/add">Add</a> </li>
                <li><a href="/final/bill">Bill</a> </li>
                <li><a href="/final/bag_by_designer">Search</a></li>
                <li><a href="/final/best_customers">Customers</a> </li>
                <li><a href="/final/mybag">My bag</a></li>
            </ul>
        </nav>
    </aside>
    <div class='main'>
        <div class='back'>
            <div class='title'>
                <p>Bag by Designer</p>
            </div>
            <div class='neirong'>
                <form class='search' action="bag_by_designer.php" method="post">
                    <input type="text" name="Dname" placeholder="Please enter Designer's id">
                    <input class='button' type="submit" value="Submit" name="Submit">
                </form>

                <?php
                include("conn.php");
                mysqli_query($conn, "set names gb2312");
                error_reporting(0);
                $Dname = $_POST['Dname'];
                $sql = "call bag_by_designer('$Dname')";
                $res = mysqli_query($conn, $sql);
                $rows = mysqli_num_rows($res);

                if (isset($_POST['Submit'])) {
                    if ($rows) {
                        echo '</div>';
                        $field = mysqli_num_fields($res);

                        echo '<table class="table">';
                        echo '<thead><tr>';
                        echo '<th>#</th>';
                        for ($j = 0; $j < $field; $j++) {
                            $field_info = mysqli_fetch_field_direct($res, $j);
                            echo "<th>$field_info->name</th>";
                        }
                        echo '</tr></thead>';

                        echo '<tbody>';

                        for ($i = 1; $i <= $rows; $i++) {
                            echo "<tr><td>$i</td>";
                            $data = mysqli_fetch_array($res);
                            for ($j = 0; $j < $field; $j++) {
                                echo "<td>$data[$j]</td>";
                            }
                            echo '</tr>';
                        }
                        echo '</tbody></table>';
                    } else {
                        echo "<p>Designer $Dname not exist</p></div>";
                    }
                }
                ?>
            </div>
        </div>
</body>

</html>

5.计算出每个客户保管包的时间,按最长时间到最短时间进行排序

设计一个存储过程

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `best_customers`()
select 
        last_name as 'Last Name',
        first_name as 'First Name',
        address as 'Address',
        phone as 'Telephone',
        ifnull(sum(datediff( date_returned, date_rented)), 0) 
            as 'Total Length of Rentals' 
    from customer as c 
    left join rental as r 
    on c.cid = r.cid 
    group by c.cid 
    order by `Total Length of Rentals` desc$$
DELIMITER ;

点击customer标签,web会自动列出顾客的消费金额

在这里插入图片描述

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>主页</title>
    <style>
        body {
            background-color: whitesmoke;
        }

        .title p {
            font-size: 30px;
            background-color: whitesmoke;
            text-transform: capitalize;
            text-align: left;
            border-left: 5px solid black;
            padding-left: 10px;
        }

        .title {
            width: 500px;
        }

        .firstrow {
            text-transform: capitalize;
        }

        a:link {
            color: black;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        a:visited {
            color: black;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        table {
            text-align: left;

            background-color: whitesmoke;
            border-radius: 5px;
            width: 1000px;
            border-top: 10px solid black;
            border-spacing: 10px;
            margin-left: 10px;
        }

        td,
        th {
            min-width: 100px;
            border-bottom: 1px solid gray;
            margin-left: 10px;
        }

        .insert {
            text-align: center;
            background-color: black;
        }

        .back {
            background-color: whitesmoke;
        }

        .main {
            float: left;
        }

        .search {

            margin-left: 10px;
            ;
        }

        .button {
            background: whitesmoke;
        }

        .neirong {
            margin-bottom: 40px;
        }

        .neirong p {
            margin-left: 10px;
        }

        aside.NavSidebar {
            padding: 5px 15px 5px 15px;
            width: 203px;
            background-color: whitesmoke;
            font-size: small;
            float: left;
            margin-right: 10px;
        }

        aside.NavSidebar h2 {
            color: black;
            border-bottom: thin black solid;
            margin-bottom: 10px;
            margin-top: 20px;
        }

        aside.NavSidebar ul {
            padding-left: 15px;
        }

        aside.NavSidebar li {
            padding-bottom: 8px;
        }
    </style>
</head>

<body>
    <aside class="NavSidebar">
        <nav>
            <h2>LL Company</h2>
            <ul>
                <li><a href="/final/Show">Rent</a> </li>
                <li><a href="/final/add">Add</a> </li>
                <li><a href="/final/bill">Bill</a> </li>
                <li><a href="/final/bag_by_designer">Search</a></li>
                <li><a href="/final/best_customers">Customers</a> </li>
                <li><a href="/final/mybag">My bag</a></li>
            </ul>
        </nav>
    </aside>
    <div class='main'>
        <div class='back'>
            <div class='title'>
                <p>Best Customers</p>
            </div>

            <?php
            include("conn.php");
            mysqli_query($conn, "set names gb2312");

            $sql = "call best_customers";
            $res = mysqli_query($conn, $sql);
            $rows = mysqli_num_rows($res);

            if ($rows) {
                $field = mysqli_num_fields($res);

                echo '<table class="table">';
                echo '<thead><tr>';
                echo '<th>#</th>';
                for ($j = 0; $j < $field; $j++) {
                    $field_info = mysqli_fetch_field_direct($res, $j);
                    echo "<th>$field_info->name</th>";
                }
                echo '</tr></thead>';

                echo '<tbody>';

                for ($i = 1; $i <= $rows; $i++) {
                    echo "<tr><td>$i</td>";
                    $data = mysqli_fetch_array($res);
                    for ($j = 0; $j < $field; $j++) {
                        echo "<td>$data[$j]</td>";
                    }
                    echo '</tr>';
                }
                echo '</tbody></table>';
            }

            ?>
        </div>
    </div>
</body>

</html>

6.计算并列出每个客户的消费金额。 这些金额将反映出这个包已经租了多少天

设计一个存储过程,统计该客户租借的所有手袋:

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `report_customer_amount`(IN `customer_id` INT(32))
select 
        c.last_name as 'Last Name',
        c.first_name as 'First Name',
        d.name as 'Manufacturer',
        b.btype as 'Name',
        datediff( r.date_returned, r.date_rented) as 'totalDays',
        (d.price + r.optional_insurance) 
            * datediff( r.date_returned, r.date_rented) as 'Cost'
    from rental as r 
    left join customer as c 
    on r.cid = c.cid 
    left join bag as b 
    on r.bid = b.bid 
    left join designer as d 
    on d.did = b.did 
    where r.cid = customer_id
    order by Cost desc$$
DELIMITER ;

设计第二个存储过程,统计该客户总花费

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `report_customer_totalCost`(IN `customer_id` INT(32))
select 
        c.last_name as 'Last Name',
        c.first_name as 'First Name',
        sum((d.price + r.optional_insurance) 
            * datediff( r.date_returned, r.date_rented)) as totalCost
    from rental as r 
    left join customer as c 
    on r.cid = c.cid 
    left join bag as b 
    on r.bid = b.bid 
    left join designer as d 
    on d.did = b.did 
    where r.cid = customer_id$$
DELIMITER ;

通过输入客户id号,可以实现账单的查询:

在这里插入图片描述

以及友好的错误输入提示:
在这里插入图片描述

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>主页</title>
    <style>
        body {
            background-color: whitesmoke;
        }

        .title p {
            font-size: 30px;
            background-color: whitesmoke;
            text-transform: capitalize;
            text-align: left;
            border-left: 5px solid black;
            padding-left: 10px;
        }

        .main {
            float: left;
        }

        .title {
            width: 500px;

        }

        .firstrow {
            text-transform: capitalize;
        }

        a:link {
            color: blue;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        a:visited {
            color: black;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        table {
            text-align: left;

            background-color: whitesmoke;
            border-radius: 5px;
            width: 1000px;
            border-top: 10px solid black;
            border-spacing: 10px;
            margin-left: 10px;
        }

        td,
        th {
            min-width: 100px;
            border-bottom: 1px solid gray;
            margin-left: 10px;
        }

        .insert {
            text-align: center;
            background-color: black;
        }

        .back {
            background-color: whitesmoke;

        }

        .search {

            margin-left: 10px;
            ;
        }

        .button {
            background: whitesmoke;
        }

        .neirong {
            margin-bottom: 40px;
        }

        .neirong p {
            margin-left: 10px;
        }

        aside.NavSidebar {
            padding: 5px 15px 5px 15px;
            width: 203px;
            background-color: whitesmoke;
            font-size: small;
            float: left;
            margin-right: 10px;
        }

        aside.NavSidebar h2 {
            color: black;
            border-bottom: thin black solid;
            margin-bottom: 10px;
            margin-top: 20px;
        }

        aside.NavSidebar ul {
            padding-left: 15px;
        }

        aside.NavSidebar li {
            padding-bottom: 8px;
        }
    </style>
</head>

<body>
    <aside class="NavSidebar">
        <nav>
            <h2>LL Company</h2>
            <ul>
                <li><a href="/final/Show">Rent</a> </li>
                <li><a href="/final/add">Add</a> </li>
                <li><a href="/final/bill">Bill</a> </li>
                <li><a href="/final/bag_by_designer">Search</a></li>
                <li><a href="/final/best_customers">Customers</a> </li>
                <li><a href="/final/mybag">My bag</a></li>
            </ul>
        </nav>
    </aside>
    <div class='main'>
        <div class='back'>
            <div class='title'>
                <p>Rental Cost Per Customer</p>
            </div>
            <div class='neirong'>
                <form class='search' action="bill.php" method="post">
                    <input type="text" name="Dname" placeholder="Please enter customer's id">
                    <input class='button' type="submit" value="Submit" name="Submit">
                </form>

                <?php
                include("conn.php");
                mysqli_query($conn, "set names gb2312");
                error_reporting(0);
                $Dname = $_POST['Dname'];
                $sql = "call report_customer_amount($Dname)";
                $res = mysqli_query($conn, $sql);
                $rows = mysqli_num_rows($res);

                if (isset($_POST['Submit'])) {
                    if ($rows) {
                        echo "<p>Customer whose id is $Dname 's bill</p></div>";
                        $field = mysqli_num_fields($res);

                        echo '<table class="table">';
                        echo '<thead><tr>';
                        echo '<th>#</th>';
                        for ($j = 0; $j < $field; $j++) {
                            $field_info = mysqli_fetch_field_direct($res, $j);
                            echo "<th>$field_info->name</th>";
                        }
                        echo '</tr></thead>';

                        echo '<tbody>';

                        for ($i = 1; $i <= $rows; $i++) {
                            echo "<tr><td>$i</td>";
                            $data = mysqli_fetch_array($res);
                            for ($j = 0; $j < $field; $j++) {
                                echo "<td>$data[$j]</td>";
                            }
                            echo '</tr>';
                        }

                        // mysqli_free_result($res);
                        mysqli_close($conn);
                        include("conn.php");
                        mysqli_query($conn, "set names gb2312");
                        $sql = "call report_customer_totalCost($Dname)";
                        $res = mysqli_query($conn, $sql);
                        $data = mysqli_fetch_array($res);
                        echo '<tr><td></td><td></td><td></td><td></td><td></td><td>Total Bill</td>';
                        echo "<td>$$data[2]</td>";
                        echo '</tr></tbody></table>';
                    } else {
                        echo "<p>Customer whose id is $Dname not exist</p></div>";
                    }
                }
                ?>
            </div>
        </div>
</body>

</html>

7.写一个存储过程,实现手袋表的信息添加

设计一个存储过程,实现新设计者的添加

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `add_designer`(id int(32),bagDesigner varchar(30),price_per_date double(32,2))
insert into designer( did,name,price) 
    values (id, bagDesigner,price_per_date)$$
DELIMITER ;

设计一个存储过程,实现新手袋的添加

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `add_bag`(id int(32),bagType varchar(30), bagColor varchar(10), bagDesigner varchar(30))
insert into bag( bid,btype, color, did) 
    values (id, bagType, bagColor, (select did 
                                from designer
                                where name = bagDesigner))$$
DELIMITER ;

管理者可以通过输入手袋类型,手袋颜色,设计者名字,每天价格,从而来添加新的手袋:
在这里插入图片描述

php会自动判别设计者是否为新的设计者,从而确定是否需要在设计者表中插入新的数据

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>主页</title>
    <style>
        body {
            background-color: whitesmoke;
        }

        .title p {
            font-size: 30px;
            background-color: whitesmoke;
            text-transform: capitalize;
            text-align: center;
            border-bottom: 5px solid black;

        }

        .title {
            width: 500px;
            text-align: center;
            margin: auto;
        }

        .firstrow {
            text-transform: capitalize;
        }

        a:link {
            color: blue;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        a:visited {
            color: black;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        table {
            text-align: left;

            background-color: whitesmoke;
            border-radius: 5px;

            border-spacing: 10px;
            margin: auto;
        }

        td,
        th {
            min-width: 100px;
            border-bottom: 1px solid gray;
            margin-left: 10px;
        }

        .insert {
            text-align: center;
            background-color: black;
        }

        .back {
            background-color: whitesmoke;
        }

        .search {
            margin: auto;
            text-align: center;
        }

        .button {
            background: whitesmoke;
        }

        input {
            background-color: whitesmoke;
            border-color: whitesmoke;
        }

        aside.NavSidebar {
            padding: 5px 15px 5px 15px;
            width: 203px;
            background-color: whitesmoke;
            font-size: small;
            float: left;
            margin-right: 10px;
        }

        aside.NavSidebar h2 {
            color: black;
            border-bottom: thin black solid;
            margin-bottom: 10px;
            margin-top: 20px;
        }

        aside.NavSidebar ul {
            padding-left: 15px;
        }

        aside.NavSidebar li {
            padding-bottom: 8px;
        }

        .main {
            float: left;
        }
    </style>
</head>

<body>
    <aside class="NavSidebar">
        <nav>
            <h2>LL Company</h2>
            <ul>
                <li><a href="/final/Show">Rent</a> </li>
                <li><a href="/final/add">Add</a> </li>
                <li><a href="/final/bill">Bill</a> </li>
                <li><a href="/final/bag_by_designer">Search</a></li>
                <li><a href="/final/best_customers">Customers</a> </li>
                <li><a href="/final/mybag">My bag</a></li>
            </ul>
        </nav>
    </aside>
    <div class='main'>
        <div class='back'>
            <div class='title'>
                <p>Add new bag</p>
            </div>
            <div class='neirong'>
                <form class='search' action="add.php" method="post">
                    <table>
                        <tr>
                            <td>Bag type</td>
                            <td><input type="text" name="btype" placeholder="Big"></td>
                        </tr>
                        <tr>
                            <td>Bag Color</td>
                            <td><input type="text" name="bcolor" placeholder="Red"></td>
                        </tr>
                        <tr>
                            <td>Designer Name</td>
                            <td><input type="text" name="dname" placeholder="Prada"></td>
                        </tr>
                        <tr>
                            <td>Price Per Day</td>
                            <td><input type="text" name="price" placeholder="3.00"></td>
                        </tr>
                        <tr>
                            <td colspan='2' style='text-align:center;'><input class='button' type="submit" value="Add" name="submit"></td>
                        </tr>

                    </table>
                </form>

                <?php
                include("conn.php");
                mysqli_query($conn, "set names gb2312");
                error_reporting(0);
                $btype = $_POST['btype'];
                $bcolor = $_POST['bcolor'];
                $dname = $_POST['dname'];
                $price = $_POST['price'];

                $sql = "select name from designer";
                $res = mysqli_query($conn, $sql);
                $rows = mysqli_num_rows($res);
                for ($i = 0; $i < $rows; $i++) {
                    $data = mysqli_fetch_array($res);
                    if ($data[0] == $dname) {
                        $have = 1;
                        break;
                    } else
                        $have = 0;
                }

                $sql = "select bid from bag";
                $res = mysqli_query($conn, $sql);
                $rows = mysqli_num_rows($res);
                $bid = 101 + $rows;

                $sql = "select did from designer";
                $res = mysqli_query($conn, $sql);
                $rows = mysqli_num_rows($res);
                $did = 101 + $rows;


                if (isset($_POST['submit'])) {
                    if ($have) {
                        $sql = "call add_bag($bid,'$btype','$bcolor','$dname')";
                        $res = mysqli_query($conn, $sql);
                        if ($res)
                            echo "<script language=javascript>window.alert('add sccessfully,please return');history.back(1);</script>";
                        else
                            echo "<script language=javascript>window.alert('add fail,please return');history.back(1);</script>";
                    } else {
                        $sql = "call add_designer($did,'$dname',$price)";
                        $res = mysqli_query($conn, $sql);
                        mysqli_close($conn);
                        include("conn.php");
                        mysqli_query($conn, "set names gb2312");
                        $sql = "call add_bag($bid,'$btype','$bcolor','$dname')";
                        $res = mysqli_query($conn, $sql);
                        if ($res)
                            echo "<script language=javascript>window.alert('add sccessfully,please return');history.back(1);</script>";
                        else
                            echo "<script language=javascript>window.alert('add fail,please return');history.back(1);</script>";
                    }
                }
                ?>
            </div>
        </div>
</body>

</html>

8.写一个存储过程,展示客户名下租了未还的手袋

设计一个存储过程,罗列名下借的手袋

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `mybag`(IN `id` INT(32))
select b.bid,b.btype,b.color,d.name
from rental as r LEFT JOIN bag as b on b.bid=r.bid
LEFT JOIN designer as d on b.did=d.did
where cid=id and already_rented=1$$
DELIMITER ;

在这里插入图片描述

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>主页</title>
    <style>
        body {
            background-color: whitesmoke;
        }

        .title p {
            font-size: 30px;
            background-color: whitesmoke;
            text-transform: capitalize;
            text-align: left;
            border-left: 5px solid black;
            padding-left: 10px;
        }

        .title {
            width: 500px;
        }

        .firstrow {
            text-transform: capitalize;
        }

        a:link {
            color: blue;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        a:visited {
            color: black;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        table {
            text-align: left;

            background-color: whitesmoke;
            border-radius: 5px;
            width: 1000px;
            border-top: 10px solid black;
            border-spacing: 10px;
            margin-left: 10px;
        }

        td,
        th {
            min-width: 100px;
            border-bottom: 1px solid gray;
            margin-left: 10px;
        }

        .insert {
            text-align: center;
            background-color: black;
        }

        .back {
            background-color: whitesmoke;
        }

        .search {

            margin-left: 10px;
            ;
        }

        .button {
            background: whitesmoke;
        }

        .neirong {
            margin-bottom: 40px;
        }

        .neirong p {
            margin-left: 10px;
        }

        aside.NavSidebar {
            padding: 5px 15px 5px 15px;
            width: 203px;
            background-color: whitesmoke;
            font-size: small;
            float: left;
            margin-right: 10px;
        }

        aside.NavSidebar h2 {
            color: black;
            border-bottom: thin black solid;
            margin-bottom: 10px;
            margin-top: 20px;
        }

        aside.NavSidebar ul {
            padding-left: 15px;
        }

        aside.NavSidebar li {
            padding-bottom: 8px;
        }

        .main {
            float: left;
        }

        .bbb {
            background-color: whitesmoke;
        }

        .ccc {
            text-align: center;
        }
    </style>
</head>

<body>
    <aside class="NavSidebar">
        <nav>
            <h2>LL Company</h2>
            <ul>
                <li><a href="/final/Show">Rent</a> </li>
                <li><a href="/final/add">Add</a> </li>
                <li><a href="/final/bill">Bill</a> </li>
                <li><a href="/final/bag_by_designer">Search</a></li>
                <li><a href="/final/best_customers">Customers</a> </li>
                <li><a href="/final/mybag">My bag</a></li>
            </ul>
        </nav>
    </aside>
    <div class='main'>
        <div class='back'>
            <div class='title'>
                <p>My bag</p>
            </div>
            <div class='neirong'>

                <?php

                include("conn.php");
                mysqli_query($conn, "set names gb2312");
                error_reporting(0);
                session_start();
                $cid = $_SESSION['cid'];
                $sql = "call mybag($cid);";
                $res = mysqli_query($conn, $sql);
                $rows = mysqli_num_rows($res);

                if ($rows) {
                    echo '</div>';
                    $field = mysqli_num_fields($res);

                    echo '<table class="table">';
                    echo '<thead><tr>';
                    echo '<th>Bag ID</th><th>Name</th><th>Color</th><th>Name</th><th class="ccc">Operation</th>';
                    echo '</tr></thead>';

                    echo '<tbody>';

                    for ($i = 1; $i <= $rows; $i++) {
                        $data = mysqli_fetch_array($res);
                        for ($j = 0; $j < $field; $j++) {
                            echo "<td>$data[$j]</td>";
                        }
                        echo "<td class='ccc'>
            <form action='return.php' method='post'>
            <input type='hidden' name='bid' value='$data[0]'>
            <input type='hidden' name='cid' value='$cid'>
            <input class='bbb' type ='submit' name='submit' value='Return'></form>
            </td></tr>";
                    }
                    echo '</tbody></table>';
                } else {
                    echo "<p>No bag was rented</p></div>";
                }
                ?>
            </div>
        </div>
</body>

</html>

9.利用触发器,实现手袋退回并能重新出租,同时打印出租的总时长和总金额

设计一个触发器,当手袋状态被更新时触。

CREATE TRIGGER `returnbag` AFTER UPDATE ON `rental`
 FOR EACH ROW BEGIN
declare pricePerday double(10,2);
set @totalDays = 0;
    set @bill = 0.00;
    if new.date_returned then 
        select 
            price into pricePerday 
            from bag as b, designer d
            where b.bid = new.bid
            and b.did = d.did;
        select 
            datediff(new.date_returned, new.date_rented) into @totalDays;
        select 
            (pricePerday + new.optional_insurance) * @totalDays into @bill;
    end if;
    update bag set already_rented = false where bid = new.bid;
    INSERT INTO money(`cid`, `bid`, `totalday`, `bill`) VALUES (new.cid,new.bid,@totalDays,@bill);
End

在前端页面打印出租的总时长和总金额

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>主页</title>
    <style>
        body {
            background-color: whitesmoke;
        }

        .title p {
            font-size: 30px;
            background-color: whitesmoke;
            text-transform: capitalize;
            text-align: left;
            border-left: 5px solid black;
            padding-left: 10px;
        }

        .title {
            width: 500px;
        }

        .firstrow {
            text-transform: capitalize;
        }

        a:link {
            color: blue;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        a:visited {
            color: black;
            font-size: 15px;
            text-transform: capitalize;
            text-decoration: none;
        }

        table {
            text-align: left;

            background-color: whitesmoke;
            border-radius: 5px;
            width: 1000px;
            border-top: 10px solid black;
            border-spacing: 10px;
            margin-left: 10px;
        }

        td,
        th {
            min-width: 100px;
            border-bottom: 1px solid gray;
            margin-left: 10px;
        }

        .insert {
            text-align: center;
            background-color: black;
        }

        .back {
            background-color: whitesmoke;
        }

        .search {

            margin-left: 10px;
            ;
        }

        .button {
            background: whitesmoke;
        }

        .neirong {
            margin-bottom: 40px;
        }

        .neirong p {
            margin-left: 10px;
        }

        aside.NavSidebar {
            padding: 5px 15px 5px 15px;
            width: 203px;
            background-color: whitesmoke;
            font-size: small;
            float: left;
            margin-right: 10px;
        }

        aside.NavSidebar h2 {
            color: black;
            border-bottom: thin black solid;
            margin-bottom: 10px;
            margin-top: 20px;
        }

        aside.NavSidebar ul {
            padding-left: 15px;
        }

        aside.NavSidebar li {
            padding-bottom: 8px;
        }

        .main {
            float: left;
        }

        .bbb {
            background-color: whitesmoke;
        }

        .ccc {
            text-align: center;
        }
    </style>
</head>

<body>
    <aside class="NavSidebar">
        <nav>
            <h2>LL Company</h2>
            <ul>
                <li><a href="/final/Show">Rent</a> </li>
                <li><a href="/final/add">Add</a> </li>
                <li><a href="/final/bill">Bill</a> </li>
                <li><a href="/final/bag_by_designer">Search</a></li>
                <li><a href="/final/best_customers">Customers</a> </li>
                <li><a href="/final/best_customers">My bag</a></li>
            </ul>
        </nav>
    </aside>
    <div class='main'>
        <div class='back'>
            <div class='title'>
                <p>My bag</p>
            </div>
            <div class='neirong'>

                <?php
                include("conn.php");
                mysqli_query($conn, "set names gb2312");
                error_reporting(0);
                $bid = $_POST['bid'];
                $cid = $_POST['cid'];

                $sql = "update rental set date_rented=curdate() where cid=$cid and bid=$bid";
                $res = mysqli_query($conn, $sql);

                $sql = "select bid,totalday,bill FROM money LIMIT 1";
                $res = mysqli_query($conn, $sql);
                $data = mysqli_fetch_array($res);
                echo "<p>The bag id: $data[0], total days you rent it : $data[1], the bill you should pay : $$data[2].</p>";

                $sql = "delete from money";
                $res = mysqli_query($conn, $sql);
                ?>
            </div>
        </div>
</body>

</html>

Sidebar h2 {
color: black;
border-bottom: thin black solid;
margin-bottom: 10px;
margin-top: 20px;
}

    aside.NavSidebar ul {
        padding-left: 15px;
    }

    aside.NavSidebar li {
        padding-bottom: 8px;
    }

    .main {
        float: left;
    }

    .bbb {
        background-color: whitesmoke;
    }

    .ccc {
        text-align: center;
    }
</style>

My bag

            <?php
            include("conn.php");
            mysqli_query($conn, "set names gb2312");
            error_reporting(0);
            $bid = $_POST['bid'];
            $cid = $_POST['cid'];

            $sql = "update rental set date_rented=curdate() where cid=$cid and bid=$bid";
            $res = mysqli_query($conn, $sql);

            $sql = "select bid,totalday,bill FROM money LIMIT 1";
            $res = mysqli_query($conn, $sql);
            $data = mysqli_fetch_array($res);
            echo "<p>The bag id: $data[0], total days you rent it : $data[1], the bill you should pay : $$data[2].</p>";

            $sql = "delete from money";
            $res = mysqli_query($conn, $sql);
            ?>
        </div>
    </div>
```
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

深圳大学数据库系统实验 Leasing Luxury Database system 基于PHP,MySQL,Web三件套 的相关文章

  • PHP 从命令行启动 gui 程序,但 apache 不启动

    首先 我阅读了有类似问题的人的一些帖子 但所有答案都没有超出导出 DISPLAY 0 0 和 xauth cookies 这是我的问题 提前感谢您的宝贵时间 我开发了一个小库 它使用 OpenGL 和 GLSL 渲染货架 过去几天我将它包装
  • xdebug.remote_handler 在 PHP.INI 中设置,但未在 PHPinfo 中显示

    我正在尝试让 Xbdebug 与 NetBeans 一起运行 以便调试一些 PHP 代码 我确信几年前我已经让它工作了 然后切换了 IDE 现在想切换回来 When I try to debug the status bar shows 并
  • 在laravel中组合两个不同的无关系数据库表查询进行分页

    我的数据库中有两个不相关的表 我需要将它们合并 以便我可以将其放在我的搜索视图中 但我不知道是否可能 这是我的代码 这news and season表不相关 但它们具有相似的列 我试图将其放入一个对象中以便于分页 是否可以 search r
  • 使用 phpdocx 下载损坏的 .docx

    我有一个项目 我们使用 phpdocx pro 在模板中生成 docx 文件 我可以很容易地将数据输入到模板中 但是当下载文件并在 MS Word 2010 中打开时 程序报告无法打开文件 因为内容存在问题 详细信息是 文件已损坏 并且无法
  • 将查询字符串附加到任何形式的 URL

    我要求用户在文本框中输入 URL 并需要向其附加查询字符串 URL 的可能值如下 http www example com http www example com http www example com a http www examp
  • Zend Framework 中的动态默认模块

    有谁知道在 Zend Framework 中动态设置默认模块并且不会遇到命名空间问题的方法 例如 我想要做的是有一个允许加载的模块表 其中一个设置为默认模块 例如 我可能有 admin blog calendar 作为可以加载的模块 如果我
  • Facebook iFrame 应用程序 - 摆脱垂直滚动条?

    我已经转换了一个 Facebook 应用程序 http apps facebook com video preferans 从 FBML 到 iFrame 使用 PHP SDK 现在显示的垂直滚动条与我之前显示的内容数量相同 一个徽标 一个
  • Laravel/00webhost 错误 404。在此服务器上找不到请求的 URL

    1 将我的文件上传到 000webhost 我将公用文件夹中的所有文件放置到公共 html然后我创建了一个名为laravel我在那里上传了所有其他文件 这是我的目录结构 laravel app 引导程序 config 公共 html 索引
  • 将IP保存到数据库中

    当用户登录时 我想将他们的 IP 保存在数据库中 我该怎么做呢 MySQL 字段最适合使用哪种类型 获取IP的PHP代码是什么样的 我正在考虑将其用作登录 会话内容的额外安全功能 我正在考虑使用用户现在拥有的 IP 检查用户从数据库登录的
  • yii2 中的自动完成

    在 Yii2 中 我希望当用户开始输入时 我的输入字段之一能够自动完成 下面是我的代码 它使用Jui Autocomplete 这是行不通的 当我打印我的数组时 我就像 Array 1 gt abc 2 gt xyz 4 gt pqr
  • Composer 无法获取 github

    今天 我尝试通过运行来安装 Laravelcomposer create project laravel laravel 5 1 myproject prefer dist我收到此错误 Could not fetch https api g
  • 如何使用 jQuery Ajax 将 PHP 数组值传递到另一个文件?

    这是我的代码
  • 付款成功后保存到数据库(paypal)

    我试图找出在客户使用 paypal 支付商品费用后将数据 之前以表单提交 保存到数据库的最佳方法 沿着这个过程的一些事情 1 在实际网站上填写表格 gt 2 登录 Paypal gt 3 立即付款 PayPal gt 4 数据已插入数据库
  • PHP 脚本不断执行 mmap/munmap

    我的 PHP 脚本包含一个循环 它只不过是回显和取消引用指针 如 tab othertab i gt 中的内容 直到昨天 这个脚本开始变得非常慢 比以前慢了 50 倍 之前 它一直运行良好 使用 strace 后 我发现 90 的情况下 脚
  • 使用 yum 和 pear 安装 php-soap 均失败

    我正在尝试在 Centos 6 4 服务器上安装 PHP 的 SOAP 扩展 我对包管理器 从 CLI 安装包并在 PHP 中配置它们相当不熟悉 我相当有能力管理 php ini 和其他 PHP 配置文件 soap ini 等 我尝试使用以
  • php如何生成动态list()?

    根据我的理解 这就是 list 的工作原理 list A1 A2 A3 array B1 B2 B3 所以在帮助下list 我们可以相应地从数组中分配值 这是我的问题 如何生成动态list 1 基于数据库返回结果 我不确定有多少 但我将其全
  • 在 PHP 中接受带有小数点和千位分隔符的国际数字

    对于用户可以输入能量值来计算相应费用的在线计算器 我需要 PHP 脚本来接受各种用户输入 200 万又四分之一焦耳 的值可以输入为 2000000 25 默认表示法 2 000 000 25 带千位分隔符 2000000 25 逗号作为小数
  • 通过身份验证保护 CodeIgniter 2 应用程序的正确方法是什么?

    I have Ion Auth http benedmunds com ion auth 正确安装并在我的服务器上运行 我也有默认的代码点火器2 新闻 教程在同一个 CI 安装中工作 我只是在玩 并对使用身份验证系统 封闭 或保护整个应用程
  • 如何将图像从 Android 应用程序上传到网络服务器的特定文件夹中

    如何将图像从 android 移动到 Web 服务器上的指定文件夹 这是我的安卓代码 package com example bitmaptest import java io ByteArrayOutputStream import ja
  • 我可以让 swagger-php 在查询字符串上使用数组吗?

    我使用 Swagger php 当我定义查询字符串上的参数时 它可以是一个数组 但据我所知 它不支持这种查询字符串 https api domain tld v1 objects q 1 q 5 q 12 我相信这会被设定in the co

随机推荐

  • Nginx常用命令以及升级(window)

    nginx Windows作为标准控制台应用程序 不是服务 运行 可以使用以下命令对其进行管理 start nginx 启动Nginx nginx s stop fast shutdown 快速停止 nginx s quit gracefu
  • 基础css-flex布局基础属性

    1 flex布局 弹性布局 伸缩布局 设置当前盒子为弹性盒子 display flex 设置主轴方向的对齐方式 justify content justify content center 设置侧轴方向的对齐方式 align items a
  • replace(),IndexOf(),substring() ,lastIndexOf() ,split() ,pollFirst() ,pollFirst()

    replace pattern replacement 使用replacement替换pattern 如果pattern是字符串只替换第一个匹配项 如果pattern是正则表达式则替换每次匹配都要调用的回调函数 实例 String a 1
  • win10 系统开启自带热点,手机无法连接(连接超时)

    win10开始自带热点 手机成功连接 颇费周折 所以在此记录一下 也给其他人一个参考 今天想在win10上安装个WIFI软件 好让手机连接 结果无意间发现win10自带了热点功能 于是赶紧打开 手机的WIFI列表也显示出来了 本以为就这样愉
  • 国际MES供应商与产品大全

    最近花了一点时间 将国际上知名的MES厂商和其产品整理了一下 如下 ABB ABB 苏黎世 瑞士 是一个240亿美元的自动化和电力技术的全球业务的供应商 它的制造软件利用其控制及自动化产品通用解决方案的一部分 其系统800xa控制体系结构
  • Android 自定义播放暂停按钮图片

    Android 自定义播放暂停按钮图片 在开发Android应用程序时 我们经常需要使用播放暂停按钮来控制媒体播放器的状态 虽然Android提供了默认的播放暂停按钮 但有时候我们希望根据设计需求自定义这些按钮的外观 在本文中 我将详细介绍
  • 嵌入式毕设分享 自动晾衣架设计与实现(源码+硬件+论文)

    文章目录 0 前言 1 主要功能 2 硬件设计 原理图 3 核心软件设计 4 实现效果 5 最后 0 前言 这两年开始毕业设计和毕业答辩的要求和难度不断提升 传统的毕设题目缺少创新和亮点 往往达不到毕业答辩的要求 这两年不断有学弟学妹告诉学
  • 解决tmux启动「can't create socket」的问题

    Tmux是终端重度用户的好帮手 你再也不用担心以下问题 任务运行一半要下班 发现忘记使用nohup 网络不稳定 终端会掉线 有人找我开会 切换有线 无线会掉线 我入职以后 一直在开发机里面使用tmux和screen 在我发现tmux之前 最
  • Java的循环

    目录 1 while循环 2 do while循环 3 for 循环 1 while循环 while循环结构 语法结构 初始值 while 条件 循环操作代码块 迭代代码 执行规律 1 首先执行一次初始值 2 然后判断条件 如果条件为tru
  • ESP32的WIFI的STA模式&调控ESP32蓝牙和WIFI发射功率

    以下相关API接口的定义可进入l乐鑫官方查看 Wi Fi 库 ESP32 ESP IDF 编程指南 v4 4 文档 STA模式配置过程 include
  • springboot 获取当前日期_Spring Boot获取时间

    运行环境新建测试类 package com wusiyao websockets service import org springframework stereotype Service import java text SimpleDa
  • 【Linux后端服务器开发】常用开发工具

    目录 一 apt yum 二 gcc g 三 make makefile 四 vi vim 五 gdb 一 apt yum apt 和 yum 都是在Linux环境下的软件包管理器 负责软件的查找 安装 更新与卸载 apt 是Ubuntu系
  • 小程序经典案例

    1 上拉触底事件 data colorList isloding false getColors this setData isloding true 需要展示 loading 效果 wx showLoading title 数据加载中 w
  • Java学习笔记 03

    相关文章 Java学习笔记 01 概论 Java学习笔记 02 快速之旅 Java环境配置及HelloWorld程序 引言 写这篇文章 主要是为了以后能快速复习Java的基础语法 同时 帮助有C 等语言基础的同学快速入门Java 目录 一
  • SmartFusion从FPGA到ARM系列教程

    前言 本系列教程 将会以Microsemi SmartFusion一代芯片A2F200M3F为例 简单介绍片上ARM Cortex M3 硬核 MCU 基本外设的使用 及其与FPGA逻辑模块进行交互的示例 在学习片上硬核ARM Cortex
  • 网上阅卷系统php源码,又开源了,网上阅卷系统自动识别功能代码

    想让自己轻松点就要让计算机多为你做点 前几天一个朋友找到我让我做一个网上阅卷系统 就是实现这么几个功能 高速扫描仪扫描试卷后得到一张一张的图片 软件的功能就是处理图片 计算成绩 再详细点就是自动识别考生涂的学号 自动识别考生的选择题答案并记
  • css设计引言,HTML5与CSS3设计模式 引言(3)

    引言 3 2 代码清单2 浮动下沉首字示例 HTML pclass hanging indent spanclass hanging dropcap H span anging Dropcap p CSS hanging indent pa
  • 2022-渗透测试-git提权(Linux)

    目录 1 什么是提权 2 git提权命令 3 git的使用 1 什么是提权 提权就是通过各种办法和漏洞 提高自己在服务器中的权限 以便控制全局 利用漏洞的最终目的是获取被测系统的最高权限 即Windows中管理员账户的权限 或Linux中r
  • C++自定义connect超时时间——非阻塞套接字法

    一 代码 include
  • 深圳大学数据库系统实验 Leasing Luxury Database system 基于PHP,MySQL,Web三件套

    本实验要求搭建一个手袋租聘的数据库系统 并实现以下要求 创建一个数据库 可以记录客户数据 手袋数据 租聘数据 设计者数据 用户可以提供自己的邮箱地址 邮寄地址 信用卡号码 来注册租聘网站 数据库要展示所有课租聘的手袋 已被租聘的手袋用户不能