Here is one approach:
$myrows = $wpdb->get_results( "SELECT first_name, surname, role, email, country, bio FROM members" );
foreach ( $myrows as $row ) {
$first_name = $row->first_name;
if ( ! empty( $row->bio ) ) {
$first_name="<a href="#">" . $first_name . '</a><div class="bio" style="display: none;">' . $row->bio . '</div>';
}
echo "<tr><td>" . $first_name . "</td><td>" . $row->surname . "</td><td>" . $row->role . "</td><td>" . $row->email . "</td><td>" . $row->country . "</td></tr>";
}
Related Posts:
- Transaction when using WP functions rather than vanilla SQL?
- How to get the list of WooCommerce product image of a certain category from database?
- How to make WordPress plugin check for database changes and then do something?
- How to Join two tables from separate databases within WordPress
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- register_activation_hook isn’t adding table to DB
- What SQL / WordPress queries would need a nonce?
- Importing Geo data into wordpress database
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- $wpdb->insert() does not Insert record in a table
- Use $wpdb or other PHP script method to find/replace in WP database
- How can I add a new row in a separate database when someone registers via WordPress?
- Pull MySQL data from multiple tables and merge into 1 PHP array
- Use variable in SQL statement
- mySQL queries are executed twice on wordpress website
- making php value numeric
- Database SQL query error
- How to run complex query using PHP
- Inserting other fields to existing registration form in a WordPress theme
- SQL Query Search page
- can’t delete a row from post_meta table
- Undefined function mysql_connect()
- MySQL column count doesn’t match value count at row 1 [closed]
- SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens on line 102
- dbDelta support for FOREIGN KEY
- $wpdb->get_results(…) returns empty array despite correct query
- How to correctly submit a search form and display the result in an independent page
- Check if post of title already exists
- $wpdb->delete column values IN ARRAY()?
- Custom SQL query to get List of posts with featured image url
- Does WordPress cache get_user_meta() results?
- How to display multiple Post meta_key/meta_values by SQL query
- Delete post revisions on post publish
- Using Echo in ShortCode – Stuck
- Problems migrating WordPress to localhost
- error importing localhost export file to server
- How to sort results from a custom database table
- Update some database fields when post is saved
- sql query to put quotes around numbers in img tag
- List of posts by day of the week
- Different database query in function.php using mysqli
- Strange wordpress slowness
- Setting All Drafts to ‘exclude-from-catalog’ in WooCommerce
- How to securely provide a $_POST var in WP_Query with PHP 7?
- Create WP_Query to search for posts by their categories or their parent/child categories
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- Genesis framework comments broken?
- Databases – Submitting data from inputs to database [closed]
- WordPress SQL injection
- Grouping posts by a custom meta value
- Is it best to avoid using $wpdb for security issues?
- Should I use WordPress to skin a database website?
- WordPress Custom SQL Table with UserID Filter for results
- Correct PHP to output a single result of a Function with SQL Query
- Output: “Array”
- How to use mysql LIKE with wpdb?
- Filter results from a serialized string to use on statistics
- wordpress site – using custom database and PHP
- How to use AJAX in WordPress in MYSQL query?
- Live search from database table
- Processing ajax call to php to insert into mysql database
- wpdb getting avatars and author url
- How to create Loop code for Menu using WordPress?
- Fetching review value using wpdb class
- WordPress Custom Query: Combining Two Functions
- WP_Query: How to get results from both meta_key options?
- MySQL Query Returns Array () In Shortcode
- Passing in MySQL prepare statement parameter separately throwing error
- Error establishing a database connection (Set-up locally)
- add role on WordPress in PHP on a second database
- MYSQL TIMESTAMP when adding DATE_FORMAT then the output is blank, PHP conflict?
- Updated Php version from 5.4 to 7.2 and getting “PHP installation missing the MySQL extension needed by WordPress”
- Passing Current User ID into SQL statement
- How to optimize and reduce excessive database queries
- How to insert multiple rows and columns in database using array
- Store GA Client ID in User DB
- Running a PHP SQL script on a wordpress page
- WordPress search query, how to modify the sql
- PHP 7.2.18 | Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- Need help with format of nested array in MySQL
- Advanced WordPress SQL Query
- Splitting table data to pages with numbers
- How can get all users by current user meta (array)?
- Site doesnt work once PHP changed to 7.1
- How to detect if a revision was made by woocommerce or wordpress?
- WordPress WPDB::insert 13th param is always blank (only if format)
- Ajax not updating to database
- MySQL query in WordPress with AJAX
- Processing forms with php to wordpress database
- How to connect database table to each registered wordpress user.
- See output of a sql query while plugin installation in wordpress
- Using the same shortcode to show any table from the database
- Querying multiple meta_keys in WordPress SQL query
- Cannot Upload Custom Header Image into WordPress Dashboard
- I am unable to fetch json data from wp_db
- How to send push notification in android using php? [closed]
- Search results always returns “No results” no matter what
- Getting invalid user ID error when creating a new user with wp_insert_user
- Custom form that stores data in mysql database
- Retrieve data from external database and insert back in