discuz code


discuz code

the diskuz method

Registration method

runlog()

Support for SQL statement format
expression data processing
%t	DB::table()
%d	intval()
%s	addslashes
%n in(1,2,3)
%f sprintf('%f', $var)
%i do nothing
Method name:
DB::insert()

Explanation of the parameter:
$ table: the table where the data is inserted
$ dаta: inserted data, the value of the field corresponding to
$return_insert_id: whether to return the ID of the inserted data
$ replace: whether to use replacement in, when there is data that cannot be repeated in the table, replace in is equivalent to updating
$silent: do not request if the operation failed
example:
DB :: insert ('test_db', array ('name' => 'Zhang San'), true);
Method name:
DB::delete()

Explanation of the parameter:
$ table: table for deleting data
$ condition: delete condition
$limit: delete the number of records that meet the conditions
$ unbuffered: whether to use a query without caching
example:
DB::delete('test_db','id > 5',2);
Method name:
DB::update()

Explanation of the parameter:
$ table: table for updating data
$ dаta: updated data, corresponding field value
$ condition: update condition
$ unbuffered: whether to use a request without caching
$ low_priority: whether to use table update without locking
example:
DB::update('test_db',array('name'=>'lisi'),'id=4');
Method name:
DB::fetch_first()

Explanation of the parameter:
$ sql: SQL statement to query data
$ary: bind request parameters
$ silent: do not request if the request is not executed
example:
DB::fetch_first('SELECT * FROM %t where id > %d', array('test_db',$id) );
Method name:
DB::fetch_all()

Explanation of the parameter:
Get everything
$ sql: SQL statement to query data
$ary: bind request parameters
$keyfield: the name of the one-dimensional index field, and the value of the request ID is treated as a one-dimensional index.
$ silent: whether to output a request when a request fails
example:
$data = DB::fetch_all('SELECT * FROM %t where id > %d',array('test_db',$id),'id');
Method name:
DB::result_first()

Explanation of the parameter:
Get one line
$ sql: SQL statement to query data
$ary: bind request parameters
$ silent: do not request if the request is not executed
example:
$data = DB::result_first('SELECT * FROM %t where id > %d',array('test_db',$id));
Method name:
DB::query()

Explanation of the parameter:
$ sql: custom SQL statement
$ary: bind request parameters
$ silent: do not request if the request is not executed
$unbuffered: whether to use a request without caching
example:
$data = DB::query('SELECT * FROM %t where id > %d',array('test_db',$id));
Method name:
DB::num_rows()

Explanation of the parameter:
Get the number of rows
$ resourceid: resource
$ row: the first field of the specified row
example:
$data = DB::num_rows($res);
Method name:
DB::free_result()

Explanation of the parameter:
Release resources
$ resourceid: resource
example:
$data = DB::free_result($res);
Method name:
DB:: order()

Explanation of the parameter:
Sort
$ field: sorted field
$type: positive order, reverse order
example:
$data = DB:: order('id','asc');
Method name:
DB::limit()

Parameter explanation:
Setting the range of values
$ start: the value of the initial index
$limit: number of records
example:
$data = DB::limit('8','5');
Method name:
DB::implode==()==

Explanation of the parameter:
Merging fields
$ array: an array of characters to be glued together
$ glue: a string of fields splice
example:
$data = DB::implode('8',',');
Method name:
DB::field()

Explanation of the parameter:
Setting up Field data
$ field: name of the field being processed.
$ val: field value
$ glue: connection field type and value
example:
$data = DB::field('id','5','=');
$data = DB::field('id', array('1','2','3'), 'in');







Go back
16-11-2022, 13:11