How to get specific table by current user login

Note that you may need to use WPDB::prepare() to prevent against SQL injections. Although, it might be arguable in your specific case… // If the query does not work, ensure the table name is correct… $table = $wpdb->prefix . ‘SaveContactForm7_1’; $reservations = $wpdb->get_results( $wpdb->prepare( “SELECT * FROM $table WHERE user = %s”, $username ) ); … Read more

user update profile for custom code

I can see $topselected= get_the_author_meta( ‘user_top’, $user->ID ); , here you are using “user_top” as the meta_key but while updating you are using “user_chapter” update_usermeta( $user_id, ‘user_chapters’, $_POST[‘user_chapters’] ); Whatever name you are providing in <select name=”user_top” id=”user_top”>, should be used in $_POST[”] So here you are using “user_top” as your select name, so it … Read more

Getting error in sql query

You have a typo $a = the_ID(); $data = $wpdb->get_results(“SELECT `id`,`guid` FROM `wp_posts` WHERE `post_type` = ‘local-offer’ group by `post_author`”); $result = $wpdb->get_results(“SELECT * FROM `wp_postmeta` WHERE `post_id` = “.$a.” “);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)