Home >Backend Development >PHP Tutorial >In php's medoo, if the where parameter has multiple sub-items, must 'AND' be used?

In php's medoo, if the where parameter has multiple sub-items, must 'AND' be used?

WBOY
WBOYOriginal
2016-08-18 09:16:251303browse

The following MD() is my encapsulated method of extracting medoo

<code>
MD()->debug()->get('items_want',['id'],[
        'uid'=>74,
        'item_id'=>28,
    ]);
    </code>

//For example, in the above example, the output sql is actually: SELECT "id" FROM "items_want" WHERE "uid" = 74 "item_id" = 28 LIMIT 1

And

<code>MD()->debug()->get('items_want',['id'],[
        'AND'=>[
            'uid'=>74,
            'item_id'=>28,
        ]
    ])
    </code>

You can output
SELECT "id" FROM "items_want" WHERE "uid" = 74 AND "item_id" = 28 LIMIT 1

Reply content:

The following MD() is my encapsulated method of extracting medoo

<code>
MD()->debug()->get('items_want',['id'],[
        'uid'=>74,
        'item_id'=>28,
    ]);
    </code>

//For example, in the above example, the output sql is actually: SELECT "id" FROM "items_want" WHERE "uid" = 74 "item_id" = 28 LIMIT 1

And

<code>MD()->debug()->get('items_want',['id'],[
        'AND'=>[
            'uid'=>74,
            'item_id'=>28,
        ]
    ])
    </code>

You can output
SELECT "id" FROM "items_want" WHERE "uid" = 74 AND "item_id" = 28 LIMIT 1

Yes, because we need to deal with the relationship between AND and OR, this method is quite logical

Medoo must use and for multiple conditions, please refer to its official website or source code for details

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn