Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Array (
- [30] => Array (
- [user_id] => 2
- [product_id] => 4080
- )
- [31] => Array (
- [user_id] => 5
- [product_id] => 2942
- )
- [32] => Array (
- [user_id] => 4
- [product_id] => 9630
- )
- [33] => Array (
- [user_id] => 3
- [product_id] => 2542
- )
- [34] => Array (
- [user_id] => 7
- [product_id] => 1234
- )
- )
- global $wpdb;
- //Retrieve the bids from the database.
- $form_entries = $wpdb->get_results('SELECT * FROM '. $wpdb->prefix .'frm_item_metas WHERE field_id in (145,147)');
- $data = array();
- foreach ( $form_entries as $meta ) {
- if ( ! isset($data[$meta->item_id])){
- $data[$meta->item_id] = array();
- }
- $data[$meta->item_id][] = $meta->meta_value;
- }
- //rename the array keys
- foreach( $data as &$new_values ) {
- $new_values['user_id'] = $new_values[0]; unset( $new_values[0] );
- $new_values['product_id'] = $new_values[1]; unset( $new_values[1] );
- }
- unset($new_values);
- }
- Array (
- [30] => Array (
- 'user_id' => '2',
- 'product_id' => '4080',
- )
- [31] => Array (
- 'user_id' => '5',
- 'product_id' => '2942',
- )...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement