Title: $wpdb vs. $post ?
Last modified: August 19, 2016

---

# $wpdb vs. $post ?

 *  [jlknauff](https://wordpress.org/support/users/jlknauff/)
 * (@jlknauff)
 * [15 years ago](https://wordpress.org/support/topic/wpdb-vs-post/)
 * I know the data I need is contained in both variables, so I think I should be
   able to do this with just the $wpdb variable instead of having to use the $post
   variable.
 * Is there a better way to do this?
 *     ```
       global $wpdb;
       	global $post;
   
       	$company_name = $post->post_title;
       	$member_data = (array) $wpdb->get_row("SELECT * FROM wp_network_members WHERE company_name = '$company_name'");
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [jlknauff](https://wordpress.org/support/users/jlknauff/)
 * (@jlknauff)
 * [15 years ago](https://wordpress.org/support/topic/wpdb-vs-post/#post-1967714)
 * Does anyone have a way to pull the data I need from $wpdb instead of using $post-
   >post_title ?

Viewing 1 replies (of 1 total)

The topic ‘$wpdb vs. $post ?’ is closed to new replies.

## Tags

 * [wpdb](https://wordpress.org/support/topic-tag/wpdb/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 1 participant
 * Last reply from: [jlknauff](https://wordpress.org/support/users/jlknauff/)
 * Last activity: [15 years ago](https://wordpress.org/support/topic/wpdb-vs-post/#post-1967714)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
