【问题标题】:Having trouble in in Json parsing and save value in database [closed]在 Json 解析中遇到问题并在数据库中保存值[关闭]
【发布时间】:2014-09-29 15:23:19
【问题描述】:

我从我的服务器收到这样的 json 响应。我想通过 mysql-PHP 将所有这些值保存在数据库中。请帮忙。

{"fields":[{"label":"Do you have a   website?","field_type":"website","required":false,"field_options":{},"cid":"c1"},{"label":"Security personnel #82?","field_type":"radio","required":true,"field_options":{"options":[{"label":"Yes","checked":false},{"label":"No","checked":false}],"include_other_option":true},"cid":"c10"},{"label":"Medical history","field_type":"file","required":true,"field_options":{},"cid":"c14"}]}

【问题讨论】:

  • 尝试编写代码将其保存到您的数据库:)
  • 那里不乏 PHP + MySQL 教程。 (尽管尝试找到一个不使用已弃用的mysql_ API)。

标签: javascript php mysql json


【解决方案1】:

如果您还没有编码,则首先必须对该 json 对象进行编码,

然后用 mysqli_real_escape_string() -php 转义引号

然后将其插入数据库。

有关更多信息,请访问 google.com

【讨论】:

    猜你喜欢
    • 2021-03-28
    • 2013-02-22
    • 1970-01-01
    • 1970-01-01
    • 2018-08-02
    • 1970-01-01
    • 2016-04-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多