My get_results query not returning any results
-
Anyone got any clues please? I expect I have done something stupid.
//Assign users to studies as authors global $wpdb; echo "Started"; $wpdb->show_errors(); // First get the profiles $result = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type='name_profile'"); print_r ($result); foreach ($result as $results){ $study_id = $results->id; echo "Study ID= ". $study_id; $study_name = $results->post_title; echo $study_name; /*$result1 = $wpdb->get_row("SELECT * FROM $wpdb->variants WHERE study = $study_name"); $author = $result1->number; $result2 = $wpdb->get_row("SELECT id FROM $wpdb->users WHERE user_login = $author"); $author = $result2->id; echo $author; $my_post = array( 'ID' => $study_id, 'post_author' => $author ); // Update the post into the database wp_update_post( $my_post );*/ echo "Updated"; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘My get_results query not returning any results’ is closed to new replies.