我正在尝试从邮递员发送发帖请求,但首先请求被接受,但数据存储为null

时间:2020-05-02 04:31:35

标签: php mysql sql

// mysql表创建

CREATE TABLE `users` (
  `id` int NOT NULL,
  `name` varchar(45) NOT NULL,
  `gender` varchar(45) NOT NULL,
  `designation` varchar(45) NOT NULL,
  `address` varchar(45) NOT NULL,
  `email` varchar(45) NOT NULL,
  `password` varchar(45) NOT NULL,
  `cpassword` varchar(45) NOT NULL,
  `age` int NOT NULL,
  `phone` int NOT NULL,
  `pincode` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

//邮递员职位请求

  {
   "name":"krithi",
   "age":15,
   "gender":"female",
   "phone":1234567890,
   "designation":"volunteer",
   "address":"chennai",
   "pincode":90,
   "password":"ac",
   "cpassword":"ac",
   "email":"abc@gmail.com"

}       

//邮递员输出

{"code":1010,"message":"Data integrity violation"}  

但是它很好地用于获取请求。任何帮助将不胜感激。

I changed my table into a simpler one   

创建表dname varchar(45)非空 )ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci 而我的json是` {

    "name" : "abc"
    }
*and the response is* 

    {
    "code": 9999,
    "message": "Argument 1 passed to Tqdev\\PhpCrudApi\\Database\\ColumnsBuilder::quoteColumnName() must be an instance of Tqdev\\PhpCrudApi\\Column\\Reflection\\ReflectedColumn, null given, called in C:\\Users\\vimy9\\OneDrive\\Desktop\\clone\\php-crud-api\\api.php on line 4892"
}

1 个答案:

答案 0 :(得分:3)

查询中有def save_file(name, content): """Decode and store a file uploaded with Plotly Dash.""" data = content.encode("utf8").split(b";base64,")[1] with open(os.path.join(UPLOAD_DIRECTORY, name), "wb") as fp: fp.write(base64.decodebytes(data)) def uploaded_files(): """List the files in the upload directory.""" files = [] for filename in os.listdir(UPLOAD_DIRECTORY): path = os.path.join(UPLOAD_DIRECTORY, filename) if os.path.isfile(path): files.append(filename) return files def file_download_link(filename): """Create a Plotly Dash 'A' element that downloads a file from the app.""" location = "/download/{}".format(urlquote(filename)) return html.A(filename, href=location) ,但在插入时未传递ID,如果要自动生成ID,则应为id int NOT NULL