<bdo id='uwTC2'></bdo><ul id='uwTC2'></ul>
    1. <legend id='uwTC2'><style id='uwTC2'><dir id='uwTC2'><q id='uwTC2'></q></dir></style></legend>

      1. <i id='uwTC2'><tr id='uwTC2'><dt id='uwTC2'><q id='uwTC2'><span id='uwTC2'><b id='uwTC2'><form id='uwTC2'><ins id='uwTC2'></ins><ul id='uwTC2'></ul><sub id='uwTC2'></sub></form><legend id='uwTC2'></legend><bdo id='uwTC2'><pre id='uwTC2'><center id='uwTC2'></center></pre></bdo></b><th id='uwTC2'></th></span></q></dt></tr></i><div id='uwTC2'><tfoot id='uwTC2'></tfoot><dl id='uwTC2'><fieldset id='uwTC2'></fieldset></dl></div>
        <tfoot id='uwTC2'></tfoot>

        <small id='uwTC2'></small><noframes id='uwTC2'>

        从文本框中的逗号分隔文本在 MYSQL 中添加新行

        Add new row in MYSQL from Comma Separated text in textbox(从文本框中的逗号分隔文本在 MYSQL 中添加新行)
            <bdo id='pyTpd'></bdo><ul id='pyTpd'></ul>
              <tbody id='pyTpd'></tbody>

              <tfoot id='pyTpd'></tfoot>
              1. <i id='pyTpd'><tr id='pyTpd'><dt id='pyTpd'><q id='pyTpd'><span id='pyTpd'><b id='pyTpd'><form id='pyTpd'><ins id='pyTpd'></ins><ul id='pyTpd'></ul><sub id='pyTpd'></sub></form><legend id='pyTpd'></legend><bdo id='pyTpd'><pre id='pyTpd'><center id='pyTpd'></center></pre></bdo></b><th id='pyTpd'></th></span></q></dt></tr></i><div id='pyTpd'><tfoot id='pyTpd'></tfoot><dl id='pyTpd'><fieldset id='pyTpd'></fieldset></dl></div>
                • <legend id='pyTpd'><style id='pyTpd'><dir id='pyTpd'><q id='pyTpd'></q></dir></style></legend>

                  <small id='pyTpd'></small><noframes id='pyTpd'>

                  本文介绍了从文本框中的逗号分隔文本在 MYSQL 中添加新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 PHP/MYsql 问题.

                  I have a PHP/MYsql question.

                  我试图在每个逗号后插入一个新行.

                  I am trying to insert a new row after each comma.

                  基本上,我想要这个功能:

                  Basically, I want this function:

                  假设我们有一个包含以下文本的文本框:

                  Let's say we have a textbox with the following text:

                  篮球、网球、足球、排球 --> 提交按钮

                  Basketball, Tennis, Futbol, Volleyball --> Submit Button

                  点击提交按钮后,我想在每个单词之后在一个表格中插入一个新行.

                  After the submit button is clicked, I want to Insert a new row in one table after each word.

                  基本上,我希望数据库中的结果是这样的

                  Basically, I want the outcome in the DB like this

                  id      category
                  1       Basketball
                  2       Tennis
                  3       Futbol
                  4       Volleyball
                  

                  谁能帮我解决这个问题?

                  Anyone can help me with this ?

                  谢谢:)

                  推荐答案

                  你可以循环遍历每一个,然后单独添加它们.

                  You could just loop through each, and add them individually.

                  $input = "Basketball, Tennis, Futbol, Volleyball";
                  foreach (explode(',',$input) as $piece)
                  {
                      $piece = mysql_real_escape_string(trim ($piece));
                      $sql = "INSERT INTO table VALUES($piece)";
                      //Run sql
                  }
                  

                  这篇关于从文本框中的逗号分隔文本在 MYSQL 中添加新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                  <small id='M5DM3'></small><noframes id='M5DM3'>

                      <tbody id='M5DM3'></tbody>
                      <legend id='M5DM3'><style id='M5DM3'><dir id='M5DM3'><q id='M5DM3'></q></dir></style></legend>

                    1. <tfoot id='M5DM3'></tfoot>

                          <bdo id='M5DM3'></bdo><ul id='M5DM3'></ul>

                          <i id='M5DM3'><tr id='M5DM3'><dt id='M5DM3'><q id='M5DM3'><span id='M5DM3'><b id='M5DM3'><form id='M5DM3'><ins id='M5DM3'></ins><ul id='M5DM3'></ul><sub id='M5DM3'></sub></form><legend id='M5DM3'></legend><bdo id='M5DM3'><pre id='M5DM3'><center id='M5DM3'></center></pre></bdo></b><th id='M5DM3'></th></span></q></dt></tr></i><div id='M5DM3'><tfoot id='M5DM3'></tfoot><dl id='M5DM3'><fieldset id='M5DM3'></fieldset></dl></div>