douchong4730 2018-11-20 19:52
浏览 93

Wordpress - 将联系表单7字段作为单独的列保存到数据库

I am using Contact Form 7 and Contact Form 7 Database Addon – CFDB7 to save values from my form to the database. The database plugin seems to work fine and saves information to the database, I am able to see all my fields in the WordPress dashboard in the format I would like however it saves all the fields and values in a "serialized" form.

enter code here a:17:{s:12:"cfdb7_status";s:4:"read";s:10:"user_login";s:5:"MyUser";s:4:"Date";s:10:"2018-11-20";s:10:"Name";s:3:"ABC";s:2:"BS";a:1:{i:0;s:1:"B";}s:3:"CMP";s:4:"1200";s:3:"CAB";a:1:{i:0;s:2:"CM";}s:2:"T1";s:3:"200";s:2:"T2";s:0:"";s:2:"T3";s:0:"";s:2:"SL";s:3:"150";s:8:"Calendar";a:1:{i:0;s:2:"TF";}s:8:"Period1C";s:0:"";s:8:"Period2C";s:0:"";s:2:"P1";s:1:"3";s:2:"P2";s:1:"6";s:8:"TimeType";a:1:{i:0;s:1:"M";}}

The CFDB7 plugin saves the above information in a separate table, however all the field data is saved in a single row. Is there a way or a plugin to save this information as separate columns in my table and all values under those columns. Something like this

User_login: MyUser Date: 2018-11-20 Name: ABC BS: B CMP: 1200 CAB: CM T1: 200 T2: 0 T3: 0 SL: 150 Calendar: TF Period1C: Period2C: P1: 3 P2: 6 TimeType: M

where User_login, Date, Name.... are all separate columns in the table and MyUser, 2018-11-20, ABC.... are the values under these columns for every entry.

Can you please advise how this can be done. The author of the plugin suggests to unserialize. I have read about unserialize but I was not able to do anything with it. I am familiar with SQL but not with PHP yet. I appreciate your help.

  • 写回答

1条回答 默认 最新

  • douwei1174 2019-01-17 22:42

    I was able to resolve this using Save Contact Form 7. I have been using it for about a month and have not encountered an issue.

    Edit: It is straightforward, you install the plugin, no configuration is required, it creates a custom table in the database with all the fields as separate columns. I have only used number type, text, radio button and dropdowns so far. Apparently, it also has the ability to save csv, pdf but I have never used it so can't tell how that works. I noticed that the plugin "hasn’t been tested with the latest 3 major releases of WordPress", however as of now it gets the job done.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥50 hyper默认的default switch
  • ¥15 网站打不开,提示502 Bad Gateway
  • ¥20 基于MATLAB的绝热压缩空气储能系统代码咨询
  • ¥15 R语言建立随机森林模型出现的问题
  • ¥20 unity内置语言切换的按钮设置
  • ¥15 中级微观经济学,生产可能性边界问题
  • ¥15 TCP传输时不同网卡传输用时差异过大
  • ¥15 请各位看看我写的属于什么算法,或者有更正确的写法?
  • ¥15 html5 qrcode 扫描器
  • ¥15 爬取网页信息并保存需要完整代码