Tag Info

Hot answers tagged


Try to replace: AND meta_value LIKE %s with AND meta_value LIKE '%%%s%%' so your SQL will become: AND meta_value LIKE '%The%' instead of: AND meta_value LIKE 'The'


If I was in your shoes, I'd use get_user_meta(). // get the users -- I'm ordering them by their username $args = array( 'orderby' => 'login', 'order' => 'ASC', ); $users = get_users( $args ); foreach( $users as $user ) { $user_meta = get_user_meta( $user->ID ); var_dump( $user_meta ); // to show you what you've got } This is a ...


Firstly, you could and should use wpdb to connect to another database. E.g. like this: $the_other_db = new wpdb( 'username', 'password', 'database', 'localhost' ); $results = $the_other_db->get_results( $sql ); Take a look at Using wpdb to connect to a separate database for more information. Secondly, like @AndrewBartel said it's ...


Why do your own database queries? Use the WP functions to do it for you. $empid = (int) $_REQUEST['empid']; $name = get_user_meta($empid, 'first_name', true) . ' ' . get_user_meta($empid, 'last_name', true);

Only top voted, non community-wiki answers of a minimum length are eligible