<legend id='3qs7A'><style id='3qs7A'><dir id='3qs7A'><q id='3qs7A'></q></dir></style></legend>

<small id='3qs7A'></small><noframes id='3qs7A'>

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

        <tfoot id='3qs7A'></tfoot>
      1. mysqli 准备语句,使用绑定参数插入 NULL

        时间:2023-07-30

            <tbody id='8cFiv'></tbody>

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

              <bdo id='8cFiv'></bdo><ul id='8cFiv'></ul>

                <legend id='8cFiv'><style id='8cFiv'><dir id='8cFiv'><q id='8cFiv'></q></dir></style></legend><tfoot id='8cFiv'></tfoot>
                  本文介绍了mysqli 准备语句,使用绑定参数插入 NULL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  有谁知道是否可以使用 MYSQLI bind_param 将 NULL 插入到列中.

                  Does anyone know if it is possible to insert NULL into a column with MYSQLI bind_param.

                  我有一种情况,有时我想在 bind_param 中将一列设置为 null.像这样...

                  I have a situation where sometimes I want to set a column to null in bind_param. Like so...

                  $column2 = "NULL";
                  $insert_data->bind_param('ss', $column1,$column2);
                  

                  显然,这只是将 NULL 作为字符串写入列.我试过 null 但它们不起作用.

                  Obviously, this just writes NULL to the column as a string. I've tried null and but they don't work.

                  我想知道是否有一些值可以使 $column2 相等,这将导致它提交实际空值.

                  I would like to know if there is some value I can make $column2 equal that will cause it to submit and actual null value instead.

                  否则,我将不得不动态构建类型和参数列表并使用 call_user_func_array 来创建我的绑定,这样如果列为空,则不会写入它们.我可以这样做,但它会导致大量繁琐的额外代码,所以我只是想知道是否可以避免这种情况.

                  Otherwise, I'll have to dynamically build the type and parameter lists and use call_user_func_array to create my binding such that columns aren't written if they are null. This I can do but it leads to a lot of fiddly extra code so I was just wondering if this can be avoided.

                  推荐答案

                  use: $column2 = null; not: $column2 = "null";

                  use: $column2 = null; not: $column2 = "null";

                  这篇关于mysqli 准备语句,使用绑定参数插入 NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:为什么 MySQLi 准备了语句? 下一篇:mysqli::get_result 有什么问题?

                  相关文章

                  最新文章

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

                  1. <small id='3hRzB'></small><noframes id='3hRzB'>

                  2. <legend id='3hRzB'><style id='3hRzB'><dir id='3hRzB'><q id='3hRzB'></q></dir></style></legend>

                      <bdo id='3hRzB'></bdo><ul id='3hRzB'></ul>

                      <tfoot id='3hRzB'></tfoot>