简体   繁体   English

提交表格后如何自动创建客户表

[英]How to create a client table automatically after submitting form

I need some theoretical assistance on the following project. 我需要以下项目的理论帮助。

Lets suppose that i have a client form with the following input fields: 假设我有一个带有以下输入字段的客户表单:

name, lastname, adress, body_weight & one submit button. 名称,姓氏,地址,body_weight和一个提交按钮。

is there any way, after submitting form to auto create a mysql table where the data of the client will be stored. 有什么办法,提交表单后自动创建一个mysql表,将在其中存储客户端的数据。 In addition, the same should happen for every new client, but for the exixting clients the data should be stored in the initial table. 此外,对于每个新客户端都应该发生相同的情况,但是对于扩展客户端,数据应该存储在初始表中。

Any thoughts on how this can be done or links to online examples would be really usefull. 关于如何完成此操作的任何想法或指向在线示例的链接都将非常有用。

Try to use this SQL query: 尝试使用此SQL查询:

IF EXISTS (SELECT * FROM :table_name)
  BEGIN
     UPDATE :table_name SET name=:name, lastname=:lastname, address:address, bodyweight:bodyweight;
  END
ELSE
  BEGIN
     CREATE :table_name (
     name varchar(128),
     lastname varchar(128),
     address varchar(128),
     body_weight unsigned tinyint
     );
     INSERT INTO :table_name (name, lastname, address, bodyweight)
     VALUES (:name, :lastname, :address, :bodyweight);
  END

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM