<bdo id='QnnjQ'></bdo><ul id='QnnjQ'></ul>
    <legend id='QnnjQ'><style id='QnnjQ'><dir id='QnnjQ'><q id='QnnjQ'></q></dir></style></legend>

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

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

    1. 当 field=0 时,mySQL 返回所有行

      时间:2023-06-25

      <small id='5PNGc'></small><noframes id='5PNGc'>

        <tbody id='5PNGc'></tbody>

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

              • 本文介绍了当 field=0 时,mySQL 返回所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在做一些测试,当我查询一个表时,很惊讶,查询 SELECT * FROM table WHERE email=0 返回了表中的所有行.

                I was making some tests, and it was a surprise when i was querying a table, and the query SELECT * FROM table WHERE email=0 returned all rows from the table.

                此表没有0"值,并且填充了常规电子邮件.

                This table has no '0' values and it's populated with regular e-mails.

                为什么会这样?这可能会导致严重的安全问题.

                Why this happens? This can lead to serious security problems.

                有没有办法在不修改查询的情况下避免这种情况?

                Is there a way to avoid this without modifying the query?

                我在这里遗漏了什么吗?

                Am i missing something here?

                谢谢.

                推荐答案

                这是因为它将电子邮件字段(我假设它是一个 varchar 字段)转换为整数.任何没有有效整数的字段都等于 0.您应该确保只将字符串字段与字符串值进行比较(日期也是如此,与日期比较).查询应如下所示.

                This is because it is converting the email field (which I assume is a varchar field) to an integer. Any field without a valid integer will equate to 0. You should make sure that you only compare string fields to string values (same goes for dates, comparing to dates). The query should be as follows.

                SELECT * FROM table WHERE email='0';
                

                这篇关于当 field=0 时,mySQL 返回所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:MySQL连接所有列 下一篇:如何在 Visual Studio 2013 中为 sqlite 配置实体框架 6

                相关文章

              • <legend id='yvnrx'><style id='yvnrx'><dir id='yvnrx'><q id='yvnrx'></q></dir></style></legend>

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

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

                  <tfoot id='yvnrx'></tfoot>

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