How can I change the following SQL statement to this format?

Source: Internet
Author: User
How can I change the following SQL statement to this format? The downloaded PHP source code seems to be in the object-oriented format! I understand it, but the format is not much written. please.
How can I change the following SQL statement to this format?

Read random rand function statements
This is generally the case.
SELECT *
FROM 'table'
WHERE id> = (select floor (MAX (id) * RAND () FROM 'product ')
Order by 'product _ id desc ';

The source code I downloaded should be in the function format! I don't know how to change it.
$ Product_tuijian = $ db-> pe_selectall ('product', array ('product _ istuijian '=> 1, 'product _ state' => 1, 'order by' => 'product _ id desc '),' * ', array (5 ));

How can I change the preceding statement into the following statement?


Reply to discussion (solution)

Search for Object/Relation Mapping (ORM)

What is your PHP source code? it depends on how the source code is parsed.

Phpshe ???
Defined by pe_selectall and _ dowhere.
Your condition id> = (select floor (MAX (id) * RAND () cannot be processed by them
Because the operator is> =
Use the SQL _selectall method directly to execute your query command.

/* = =========== */Public function pe_selectall ($ table, $ where = '', $ field = '*', $ limit_page = array () {// processing condition statement $ sqlwhere = $ this-> _ dowhere ($ where ); return $ this-> SQL _selectall ("select {$ field} from "'. dbpre. "{$ table} '{$ sqlwhere}", $ limit_page );}

Phpshe ???
Defined by pe_selectall and _ dowhere.
Your condition id> = (select floor (MAX (id) * RAND () cannot be processed by them
Because the operator is> =
Use the SQL _selectall method directly to execute your query command.

/* = =========== */Public function pe_selectall ($ table, $ where = '', $ field = '*', $ limit_page = array () {// processing condition statement $ sqlwhere = $ this-> _ dowhere ($ where ); return $ this-> SQL _selectall ("select {$ field} from "'. dbpre. "{$ table} '{$ sqlwhere}", $ limit_page );}





Cool! Which source code is displayed! I have been searching for this source code function for a long time, but it is not that complicated. Modify it.

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.