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

      1. <tfoot id='gmNwb'></tfoot>
        • <bdo id='gmNwb'></bdo><ul id='gmNwb'></ul>

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

        <legend id='gmNwb'><style id='gmNwb'><dir id='gmNwb'><q id='gmNwb'></q></dir></style></legend>
      2. PDO bindParam 成一个语句?

        时间:2023-09-19

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

              <tfoot id='Ys9QG'></tfoot>

                    <tbody id='Ys9QG'></tbody>
                1. 本文介绍了PDO bindParam 成一个语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  有什么办法可以将这些 bindParam 语句放入一个语句中吗?

                  Is there a way I can put these bindParam statements into one statement?

                  $q = $dbc -> prepare("INSERT INTO accounts (username, email, password) VALUES (:username, :email, :password)");
                  $q -> bindParam(':username', $_POST['username']);
                  $q -> bindParam(':email', $_POST['email']);
                  $q -> bindParam(':password', $_POST['password']);
                  $q -> execute();
                  

                  我在可能的情况下使用之前准备好的 mysqli,我切换到 PDO 以获得 assoc_array 支持.在 PDO 的 php.net 网站上,它在单独的行上显示它们,在我看到的所有示例中,它都在单独的行上.

                  I was using mysqli prepared before where it was possible, I switched to PDO for assoc_array support. On the php.net website for PDO it shows them on seperate lines, and in all examples I have seen it is on seperate lines.

                  有可能吗?

                  推荐答案

                  上的示例 2execute 页面就是你想要的:

                  Example 2 on the execute page is what you want:

                  $sth->execute(array(':calories' => $calories, ':colour' => $colour));
                  

                  您可能还想查看其他示例.使用问号参数,它将是:

                  You may want to look at the other examples too. With question mark parameters, it would be:

                  $q = $dbc -> prepare("INSERT INTO accounts (username, email, password) VALUES (?, ?, ?)");
                  $q->execute(array($_POST['username'], $_POST['email'], $_POST['password']));
                  

                  如果只有这些列,您可以只写:

                  If those are the only columns, you can just write:

                  $q = $dbc -> prepare("INSERT INTO accounts VALUES (?, ?, ?)");
                  $q->execute(array($_POST['username'], $_POST['email'], $_POST['password']));
                  

                  这篇关于PDO bindParam 成一个语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PDO 语句转 JSON 下一篇:PHP5 的 PDO rowCount MySQL 问题的解决方法

                  相关文章

                  最新文章

                  <tfoot id='A1I1y'></tfoot>

                    • <bdo id='A1I1y'></bdo><ul id='A1I1y'></ul>

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

                    1. <legend id='A1I1y'><style id='A1I1y'><dir id='A1I1y'><q id='A1I1y'></q></dir></style></legend>

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