admin管理员组文章数量:1130349
I'm still learning PHP and MySQL and need to create a unique number in Wordpress site (as a order number ID) every time, when user fill and submit "order" form from frontend and save it to database. Next submit will create a number+1. Website is not running on Woocommerce. No cart, checkout, products...
Thanks for help! :)
I'm still learning PHP and MySQL and need to create a unique number in Wordpress site (as a order number ID) every time, when user fill and submit "order" form from frontend and save it to database. Next submit will create a number+1. Website is not running on Woocommerce. No cart, checkout, products...
Thanks for help! :)
Share Improve this question edited Dec 30, 2018 at 11:05 fuxia♦ 107k39 gold badges255 silver badges461 bronze badges asked Dec 30, 2018 at 10:57 JurajJuraj 1542 silver badges11 bronze badges2 Answers
Reset to default 0in order to do this use
AUTO_INCREMENT PRIMARY KEY
while you define your table. Your table should be something like this:
CREATE TABLE `order` (
`order_id` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
`user_group_id` INT(11) UNSIGNED NOT NULL,
`status` BIT,
`meta` VARCHAR ( 255 ),
`value` TEXT,
`update_time` TIMESTAMP
)DEFAULT CHARSET = utf8;
remember that you could change other columns, the important one is order_id which is auto increment
You can get the unique ID number by using the merge tag {submission:sequence}. It allows you to get the submission number of the current user’s submission.It only populates after the submission data has been saved to the database.
I'm still learning PHP and MySQL and need to create a unique number in Wordpress site (as a order number ID) every time, when user fill and submit "order" form from frontend and save it to database. Next submit will create a number+1. Website is not running on Woocommerce. No cart, checkout, products...
Thanks for help! :)
I'm still learning PHP and MySQL and need to create a unique number in Wordpress site (as a order number ID) every time, when user fill and submit "order" form from frontend and save it to database. Next submit will create a number+1. Website is not running on Woocommerce. No cart, checkout, products...
Thanks for help! :)
Share Improve this question edited Dec 30, 2018 at 11:05 fuxia♦ 107k39 gold badges255 silver badges461 bronze badges asked Dec 30, 2018 at 10:57 JurajJuraj 1542 silver badges11 bronze badges2 Answers
Reset to default 0in order to do this use
AUTO_INCREMENT PRIMARY KEY
while you define your table. Your table should be something like this:
CREATE TABLE `order` (
`order_id` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
`user_group_id` INT(11) UNSIGNED NOT NULL,
`status` BIT,
`meta` VARCHAR ( 255 ),
`value` TEXT,
`update_time` TIMESTAMP
)DEFAULT CHARSET = utf8;
remember that you could change other columns, the important one is order_id which is auto increment
You can get the unique ID number by using the merge tag {submission:sequence}. It allows you to get the submission number of the current user’s submission.It only populates after the submission data has been saved to the database.
本文标签: phpCreate an unique ID number after submit form
版权声明:本文标题:php - Create an unique ID number after submit form 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749058484a2309729.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论