% S % t % f % I % s % d % n how to use it when discuz data is retrieved

Source: Internet
Author: User
Tags php basics
% S % t % f % I % s % d % n how can I use many such symbols in discuz during discuz data retrieval? in my understanding, they are alternative symbols, these symbols seem to facilitate writing.
In addition, the discuz SQL statement contains many parameters, which are not clearly stated by the official team. of course, I can only read the source code in half.
For example, sometimes in such a sentence, there is an array () followed by some parameters in the brackets. I don't know what these parameters represent.


Reply to discussion (solution)

You are too frugal
At least Post what you see?

Http://faq.comsenz.com/library/plug/construct/construct_db.htm
There is a document, but you cannot find it...

Http://faq.comsenz.com/library/plug/construct/construct_db.htm
There is a document, but you cannot find it...


Supported fomat: % tDB: table () % dintval () % saddslashes () % nin (, 3) % fsprintf ('% f', $ var) % I is used directly without processing

What do they mean?

You are too frugal
At least Post what you see?



For example
DB::query("SHOW FIELDS FROM ".DB::table($r_table), 'SILENT'))

Where $ r_table and SILENT represent, of course $ r_table is a data table name, but it is a variable from the field. how can we understand it?
For example
$ Query = DB: query ('select clid FROM % t WHERE rid = % d AND fid = % d', array ($ this-> _ table, $ rid, $ fid ));
What does array mean? what are the parameters in it?

% T: table name placeholder, DB: fetch_first ("SELECT * FROM % t", array ('Common _ member '));
% D: numeric placeholder, DB: fetch_first ("SELECT * FROM % t WHERE uid = % d", array ('Common _ member', 1); intval is automatically executed
% S: character placeholder, DB: fetch_first ("SELECT * FROM % t WHERE username = % s", array ('Common _ member', 'admin ')); will automatically execute addslashes, escape special characters
% N: DB: fetch_all ("SELECT * FROM % t WHERE uid IN (% n)", array ('Common _ member ', array (1, 2, 3 )));
% F: Similar to % d, it is only a floating point, rarely used
% I: output as is, DB: fetch_first ("SELECT * FROM % t WHERE username = '% I'", array ('Common _ member', 'admin '));

% T: table name placeholder, DB: fetch_first ("SELECT * FROM % t", array ('Common _ member '));
% D: numeric placeholder, DB: fetch_first ("SELECT * FROM % t WHERE uid = % d", array ('Common _ member', 1); intval is automatically executed
% S: character placeholder, DB: fetch_first ("SELECT * FROM % t WHERE username = % s", array ('Common _ member', 'admin ')); will automatically execute addslashes, escape special characters
% N: DB: fetch_all ("SELECT * FROM % t WHERE uid IN (% n)", array ('Common _ member ', array (1, 2, 3 )));
% F: Similar to % d, it is only a floating point, rarely used
% I: output as is, DB: fetch_first ("SELECT * FROM % t WHERE username = '% I'", array ('Common _ member', 'admin '));


What is the meaning of an array? What is the meaning of the parameters in it?

Your php basics need to be improved...
The following array is the parameter of the method fetch_first. the values in the array correspond to the placeholders such as % t, % d... in the preceding SQL statement.
For example: DB: fetch_first ("SELECT * FROM % t WHERE uid = % d", array ('Common _ member ', 1 ));
% T = pre_common_member (DB: table with table prefix will be executed by default)
% D = 1 (intval is executed by default)

Your php basics need to be improved...
The following array is the parameter of the method fetch_first. the values in the array correspond to the placeholders such as % t, % d... in the preceding SQL statement.
For example: DB: fetch_first ("SELECT * FROM % t WHERE uid = % d", array ('Common _ member ', 1 ));
% T = pre_common_member (DB: table with table prefix will be executed by default)
% D = 1 (intval is executed by default)


Suddenly, I suddenly realized that it was a function, but it was a function. of course, it was its parameter. sometimes I felt silly.

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.