<legend id='EzD31'><style id='EzD31'><dir id='EzD31'><q id='EzD31'></q></dir></style></legend>
      1. <small id='EzD31'></small><noframes id='EzD31'>

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

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

        PHP 中的 SQL 语句与 phpmyadmin 中的 SQL 语句的行为不同

        时间:2023-10-11
        1. <i id='amyuX'><tr id='amyuX'><dt id='amyuX'><q id='amyuX'><span id='amyuX'><b id='amyuX'><form id='amyuX'><ins id='amyuX'></ins><ul id='amyuX'></ul><sub id='amyuX'></sub></form><legend id='amyuX'></legend><bdo id='amyuX'><pre id='amyuX'><center id='amyuX'></center></pre></bdo></b><th id='amyuX'></th></span></q></dt></tr></i><div id='amyuX'><tfoot id='amyuX'></tfoot><dl id='amyuX'><fieldset id='amyuX'></fieldset></dl></div>

              <tbody id='amyuX'></tbody>
          • <tfoot id='amyuX'></tfoot>

                <bdo id='amyuX'></bdo><ul id='amyuX'></ul>
              • <small id='amyuX'></small><noframes id='amyuX'>

                <legend id='amyuX'><style id='amyuX'><dir id='amyuX'><q id='amyuX'></q></dir></style></legend>

                  本文介绍了PHP 中的 SQL 语句与 phpmyadmin 中的 SQL 语句的行为不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有

                  $form_store_sql = "                                                                                                                    
                       INSERT INTO myodyssey_myaccount (`id`, `email`, `username`, `password`) VALUES (NULL, 'email', 'unixmiah.formtest', 'woohoo');         
                  
                       SET @last_id_in_myaccount = LAST_INSERT_ID();                                                                                      
                  
                       INSERT INTO myodyssey_personal_info (`id`, `myodyssey_myaccount_id`) VALUES (NULL, @last_id_in_myaccount);                             
                  
                      SET @last_id_in_personal_info = LAST_INSERT_ID();                                                                                  
                  
                      INSERT INTO myodyssey_travel_info (`id`, `myodyssey_personal_info_id`)                                                                 
                          VALUES (NULL, @last_id_in_personal_info);                                                                                                      
                  
                       SET @last_id_in_travel_info = LAST_INSERT_ID();                                                                                    
                  
                       INSERT INTO myodyssey_tour_orders (`id`, `myodyssey_travel_info_id`) VALUES (NULL, @last_id_in_travel_info);";
                  
                       if(mysql_query($form_store_sql)){
                         echo "done";
                       }
                  

                  它不起作用;它不存储数据.但是,如果我从 form_store_variable 中取出 SQL 语句并将其粘贴到 phpmyadmin 的 sql 对话框中,它的行为就会有所不同,它会存储数据.我想知道在 form_store_variable 中存储 SQL 语句时我做错了什么.

                  It doesn't work; it doesn't store the data. But if I take the SQL statement out of the form_store_variable and paste it into phpmyadmin's sql dialog, it behaves differently, it stores the data. I wonder what I'm doing wrong storing the SQL statement in the form_store_variable.

                  推荐答案

                  mysql_*() 函数 NOT 允许在单个 查询中使用多个类似的语句 调用.这是针对某些形式的 SQL 注入攻击的基本防御.

                  mysql_*() functions do NOT allow multiple statements like that in a single query call. It's a basic defense against some forms of SQL injection attacks.

                  如果您在查询调用中使用了任何类型的错误处理,您就会被告知语法错误:

                  If you'd used any kind of error handling on your query call, you'd have been informed of the syntax error:

                  $result = mysql_query($form_store_sql);
                  if ($result === false) {
                     die(mysql_error());
                  }
                  

                  您必须分别query()每个单独的语句.

                  You will have to query() each of those individual statements separately.

                  这篇关于PHP 中的 SQL 语句与 phpmyadmin 中的 SQL 语句的行为不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:致命错误:在第 62 行调用未定义的方法 Action::execute()/home/public_html/syst 下一篇:连接到 MySql DB (PHP) 时遇到问题

                  相关文章

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

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

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