Medoo查询条件+排序的几个例子

Medoo是一款超轻量级的PHP SQL数据库框架,由社交网站Catfan和开源项目Qatrix的创始人开发。提供了简单,易学,灵活的API,提升开发Web应用的效率与性能

官方网站: https://medoo.in/

Medoo框架查询指定条件并排序的实例:

$database->debug()->select(“book”, “*”, [“ORDER” => [“date” => “DESC”]]);

查询语句:SELECT * FROM book ORDER BY date DESC

$database->debug()->select(“book”, “*”, [“view” => “1”,”ORDER” => [“date” => “DESC”]]);

查询语句:SELECT * FROM book WHERE view = ‘1’ ORDER BY date DESC

$database->debug()->select(“book”, “*”, [
        “AND” => [
            “type” => $_GET[“type”],
            “view” => “1”
        ],”ORDER” => [“date” => “DESC”]
    ]);

查询语句:SELECT * FROM book WHERE (type = ‘1’ AND view = ‘1’) ORDER BY date DESC

希望可供借鉴。

© Copyright Notice
THE END
If you like it, please support it.
like0Appreciate Share
Comment Grab the sofa
avatar
Welcome to leave valuable insights!
submit
avatar

Nick name

Cancel
Nick nameexpressioncodepicture

    There are currently no comments available