https://github.com/jazz-man/wp-db
https://github.com/jazz-man/wp-db
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jazz-man/wp-db
- Owner: Jazz-Man
- Created: 2017-10-23T15:34:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-09T14:21:27.000Z (over 7 years ago)
- Last Synced: 2025-01-02T11:29:06.951Z (5 months ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## The wrapper class to help WordPress CRUD for a single table.
### How To Use
```php
$mydb = new Db( 'mytable_without_wpdb_prefix' );
$all_data = $mydb->get_all( $orderby = 'date', $order = 'ASC' );
$row_data = $mydb->get_row( $column = 'id', $value = 102, $format = '%d', $output_type = OBJECT, $offset = 10 );
$columns = $mydb->get_columns();
$get_by = $mydb->get_by(
$columns = array( 'id', 'slug' ),
$field = 'id',
$field_value = 102,
$operator = '=',
$format = '%d',
$orderby = 'slug',
$order = 'ASC',
$output_type = OBJECT_K
);
$get_wheres = $mydb->get_wheres(
$column = '*',
$conditions = array(
'category' => $category,
'id' => $id
),
$operator = '=',
$format = array(
'category' => '%s',
'id' => '%d'
),
$orderby = 'category',
$order = 'ASC',
$output_type = OBJECT_K
);
$insert_id = $mydb->insert( $data = array( 'title' => 'text', 'date' => date("Y-m-d H:i:s") ) );