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

        <small id='7cPNc'></small><noframes id='7cPNc'>

        PHP mysqli bind_param 文本类型

        时间:2023-07-30

            <legend id='hABzr'><style id='hABzr'><dir id='hABzr'><q id='hABzr'></q></dir></style></legend>
              • <bdo id='hABzr'></bdo><ul id='hABzr'></ul>
                  <tbody id='hABzr'></tbody>

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

                  <tfoot id='hABzr'></tfoot>
                  本文介绍了PHP mysqli bind_param 文本类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  对于将用户评论转储到 MySQL 表中的反馈表单,我不确定用户提供的反馈文本使用哪种 bind_param 类型(MySQL 字段类型 = 文本)

                  For a feedback form that will dump user comments into a MySQL table, I'm unsure which bind_param type to use for the user-supplied feedback text (MySQL field type = text)

                  function sql_ins_feedback($dtcode,$custip,$name,$email,$subject,$feedback)
                  {
                      global $mysqli ;
                      if($stmt = $mysqli->prepare("INSERT INTO feedback (dtcode,custip,name,email,subject,feedback) VALUES (?,?,?,?,?,?)")) 
                      {
                          $stmt->bind_param("ssssss", $dtcode,$custip,$name,$email,$subject,$feedback);
                          $stmt->execute() ;
                          $stmt->close() ; 
                      }
                  }
                  

                  还是这个?

                          $stmt->bind_param("sssssb", $dtcode,$custip,$name,$email,$subject,$feedback);
                  

                  那么,blob 类型是否是文本字段的正确 bind_param 类型?

                  So, is the blob type the correct bind_param type for a text field?

                  bind_param("s") 类型的大小限制是多少?

                  What is the size limit for a bind_param("s") type?

                  在使用 bind_param("b") 时还有什么必须做的吗?该手册(以及我在某处/某时阅读的其他内容)表明 blob 类型的处理方式有所不同——我应该知道什么?

                  Is there anything else one must do when using bind_param("b") ? The manual (and something else I read somewhere/sometime) suggests blob types are treated differently -- anything I should know?

                  谢谢

                  推荐答案

                  这实际上取决于 Mysql 服务器.整个查询中组合的所有数据的默认最大大小为 1mb.请参阅:http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html

                  This actually depends on the Mysql server. The default max size for all data combined in the entire query is 1mb. See: http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html

                  如果您的数据组合在 "max_allowed_pa​​cket" 阈值,只需使用s"作为任何文本字段的绑定类型.事实上,您通常可以对任何字段类型(日期、浮点数等)使用s".

                  If your data combined is under that "max_allowed_packet" threshold, just use "s" for the binding type for any text field. Infact, you can usually get away with using "s" for any field type at all (date, float, etc).

                  如果您要插入的整个条目的总长度超过 1mb(或您将其重置为的任何值),您将需要使用 mysqli_stmt::send_long_data 方法和b"绑定类型以分块发送此特定字段.

                  If your entire entry combined that you want to insert is over 1mb (or whatever you reset it to) in length, you'll want to use mysqli_stmt::send_long_data method and the "b" binding type to send this particular field in chunks.

                  这篇关于PHP mysqli bind_param 文本类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:使用 MySQLi 从 HTML 表单向数据库插入多行 下一篇:为什么 MySQLi 准备了语句?

                  相关文章

                  最新文章

                  <tfoot id='LgUEE'></tfoot>

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

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