Add, delete, modify and check phpcms

1. Check

①select($where = '', $data = '*', $limit = '', $order = '', $group = '', $key='')

copy code
copy code
/**
     * Execute sql query
     * @param $where query condition [example `name`='$name']
     * @param $data field value to be queried [eg `name`, `gender`, `birthday`]
     * @param $limit returns the result range [example: 10 or 10, 10 is empty by default]
     * @param $order sorting method [default sorting by database default]
     * @param $group grouping method [default is empty]
     * @param $key returns the array sorted by key name
     * @return array query result set array
     */
copy code
copy code

②listinfo($where = '', $order = '', $page = 1, $pagesize = 20, $key='', $setpages = 10,$urlrule = '',$array = array(), $data = '*')

copy code
copy code
/**
     * Query multiple pieces of data and paginate
     * @param $where
     * @param $order
     * @param $page
     * @param $pagesize
     * @return unknown_type
     */
copy code
copy code

③get_one($where = '', $data = '*', $order = '', $group = '')

copy code
copy code
/**
     * Get a single record query
     * @param $where query condition
     * @param $data field value to be queried [eg `name`, `gender`, `birthday`]
     * @param $order sorting method [default sorting by database default]
     * @param $group grouping method [default is empty]
     * @return array/null data query result set, if it does not exist, return empty
     */
copy code
copy code

④query($sql)

/**
     * Directly execute sql query
     * @param $sql query sql statement
     * @return boolean/query resource If it is a query statement, return the resource handle, otherwise return true/false
     */

Second, increase

①insert($data, $return_insert_id = false, $replace = false)

copy code
copy code
/**
     * Execute the add record operation
     * @param $data The data to be added, the parameter is an array. The array key is the field value, and the array value is the data value
     * @param $return_insert_id whether to return the new ID number
     * @param $replace whether to add data in the way of replace into
     * @return boolean
     */
copy code
copy code

②insert_id()

/**
     * Get the primary key number of the last record added
     * @return int
     */

3. Change

①update($data, $where = '')

copy code
copy code
/**
     * Perform update record operation
     * @param $data The data content to be updated, the parameter can be an array or a string, an array is recommended.
     * When it is an array, the array key is the field value, and the array value is the data value
     * When it is a string [Example: `name`=' phpcms ', `hits`=`hits`+1].
     * When it is an array [Example: array('name'=>'phpcms','password'=>'123456')]
     * Another use of array array('name'=>'+=1', 'base'=>'-=1'); the program will automatically resolve to `name` = `name` + 1, `base` = `base` - 1
     * @param $where condition when updating data, can be array or string
     * @return boolean
     */
copy code
copy code

Fourth, delete

① delete($where) 

/**
     * Execute delete record operation
     * @param $where Delete data conditions, not allowed to be empty.
     * @return boolean
     */

1. Check

①select($where = '', $data = '*', $limit = '', $order = '', $group = '', $key='')

copy code
copy code
/**
     * Execute sql query
     * @param $where query condition [example `name`='$name']
     * @param $data field value to be queried [eg `name`, `gender`, `birthday`]
     * @param $limit returns the result range [example: 10 or 10, 10 is empty by default]
     * @param $order sorting method [default sorting by database default]
     * @param $group grouping method [default is empty]
     * @param $key returns the array sorted by key name
     * @return array query result set array
     */
copy code
copy code

②listinfo($where = '', $order = '', $page = 1, $pagesize = 20, $key='', $setpages = 10,$urlrule = '',$array = array(), $data = '*')

copy code
copy code
/**
     * Query multiple pieces of data and paginate
     * @param $where
     * @param $order
     * @param $page
     * @param $pagesize
     * @return unknown_type
     */
copy code
copy code

③get_one($where = '', $data = '*', $order = '', $group = '')

copy code
copy code
/**
     * Get a single record query
     * @param $where query condition
     * @param $data field value to be queried [eg `name`, `gender`, `birthday`]
     * @param $order sorting method [default sorting by database default]
     * @param $group grouping method [default is empty]
     * @return array/null data query result set, if it does not exist, return empty
     */
copy code
copy code

④query($sql)

/**
     * Directly execute sql query
     * @param $sql query sql statement
     * @return boolean/query resource If it is a query statement, return the resource handle, otherwise return true/false
     */

Second, increase

①insert($data, $return_insert_id = false, $replace = false)

copy code
copy code
/**
     * Execute the add record operation
     * @param $data The data to be added, the parameter is an array. The array key is the field value, and the array value is the data value
     * @param $return_insert_id whether to return the new ID number
     * @param $replace whether to add data in the way of replace into
     * @return boolean
     */
copy code
copy code

②insert_id()

/**
     * Get the primary key number of the last record added
     * @return int
     */

3. Change

①update($data, $where = '')

copy code
copy code
/**
     * Perform update record operation
     * @param $data The data content to be updated, the parameter can be an array or a string, an array is recommended.
     * When it is an array, the array key is the field value, and the array value is the data value
     * When it is a string [Example: `name`=' phpcms ', `hits`=`hits`+1].
     * When it is an array [Example: array('name'=>'phpcms','password'=>'123456')]
     * Another use of array array('name'=>'+=1', 'base'=>'-=1'); the program will automatically resolve to `name` = `name` + 1, `base` = `base` - 1
     * @param $where condition when updating data, can be array or string
     * @return boolean
     */
copy code
copy code

Fourth, delete

① delete($where) 

/**
     * Execute delete record operation
     * @param $where Delete data conditions, not allowed to be empty.
     * @return boolean
     */

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324529037&siteId=291194637