Tutorial by Examples

In the most basic form, it is possible to select a single variable from a table by calling the object's get_var method passing in an SQL query. global $wpdb; $user = $wpdb->get_var( "SELECT ID FROM $wpdb->users WHERE user_email='[email protected]'" ); It is very important to note that...
You can use get_results to get multiple rows from database. global $wpdb; $userTable =$wpdb->prefix."users"; $selectUser = $wpdb->get_results("SELECT * FROM $userTable"); This will show all users list in array.

Page 1 of 1