Forums

$wpdb vs. $post ? (2 posts)

  1. jlknauff
    Member
    Posted 1 year ago #

    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'");
  2. jlknauff
    Member
    Posted 1 year ago #

    Does anyone have a way to pull the data I need from $wpdb instead of using $post->post_title ?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags