图书管理系统(后端)--更新读者信息

1.更新函数文件dbop.php

query($query);

        if($result)
        {
            echo "ok";
            $conn->commit();
        }
        else
        {
            echo "error";
            $conn->rollback();
        }
    }
?>

2.api封装3.php文件

{unum};

    $row['name'] = $recv->{name};

    $row['pass'] = $recv->{pass};

    $row['conn'] = $recv->{conn};

    $row['role'] = $recv->{role};

    $row['sex'] = $recv->{sex};

    $row['rdate'] = $recv->{rdate};

    $row['edate'] = $recv->{edate};

    $row['bnum'] = $recv->{bnum};

    $row['vnum'] = $recv->{vnum};

    $row['flag'] = $recv->{flag};

    $conn = new mysqli("localhost", "niki", "niki", "niki") or dir("不能连接到mysql");

    $conn->query("set names utf8");

    upd_niki_read_info($conn, $row);

    $conn->close();
?>

3.测试脚本read_info_upd.sh

#!/bin/bash

curl -H "Content-Type:application/json" -X POST --data '{
    "unum": "s20064051303",
    "name": "小华",
    "pass": "abce",
    "conn": "2233465",
    "role": 502,
    "sex": "M",
    "rdate": "2008-06-10",
    "edate": "2010-06-02",
    "bnum": "0",
    "vnum": "1",
    "flag": "0"
}' http://10.192.89.12/local/2/3.php

4.运行脚本

$ ./read_info_upd.sh

你可能感兴趣的:(图书管理系统(后端)--更新读者信息)