Detailed solution of function code

Source: Internet
Author: User
For detailed solution to the function code, please help explain the code below in detail
Public function fetch_all_by_ SQL ($ where, $ order = '', $ start = 0, $ limit = 0, $ count = 0, $ alias = '')
{
$ Where = $ where &&! Is_array ($ where )? "WHERE $ where ":'';
If (is_array ($ order )){
$ Order = '';
}
If ($ count ){
Return DB: result_first ('SELECT count (*) from '. DB: table ($ this-> _ table ). '% I % I '. DB: limit ($ start, $ limit), array ($ alias, $ where, $ order ));
}
Return DB: fetch_all ('select * from '. DB: table ($ this-> _ table ). '% I % I '. DB: limit ($ start, $ limit), array ($ alias, $ where, $ order ));
}


Reply to discussion (solution)

You can mark it out.

I don't know.

Public function fetch_all_by_ SQL ($ where, $ order = '', $ start = 0, $ limit = 0, $ count = 0, $ alias = '')

A database search function that returns the total number

Parameter: $ where is the same as SQL WHERE
$ Order is the same as SQL ORDER
$ Start: which record does the SQL statement start to return?
$ How many records are returned by limit?
$ Count: whether to directly return the number of search results
Alias doesn't quite understand what the role is.

I don't just see a reply to the story

Upstairs + 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.