Cheatography
https://cheatography.com
$wpdb->get_var
$wpdb->get_var( 'query' ); $wpdb->get_var( 'query', column_offset, row_offset ); |
Ex: $user_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->users" ); |
$wpdb->get_row
$wpdb->get_row('query', output_type, row_offset); |
OBJECT - result will be output as an object. ARRAY_A - result will be output as an associative array ARRAY_N - result will be output as a numerically indexed array. |
$wpdb->get_col
$wpdb->get_col( 'query', column_offset ); |
$wpdb->get_results
$wpdb->get_results( 'query', output_type ); |
OBJECT - result will be output as a numerically indexed array of row objects. OBJECT_K - result will be output as an associative array of row objects, using first column's values as keys (duplicates will be discarded). ARRAY_A - result will be output as a numerically indexed array of associative arrays, using column names as keys. ARRAY_N - result will be output as a numerically indexed array of numerically indexed arrays. |
$wpdb->insert
$wpdb->insert( $table, $data, $format ); |
$wpdb->replace
$wpdb->replace( $table, $data, $format ); |
$wpdb->update
$wpdb->update( $table, $data, $where, $format = null, $where_format = null ); |
$wpdb->delete
$wpdb->delete( $table, $where, $where_format = null ); |
$wpdb->query
$wpdb->query('query'); |
$wpdb->prepare
$sql = $wpdb->prepare( 'query' , value_parameter[, value_parameter ... ] ); |
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets