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
- Can i use php sql functions instead of $wpdb?
- How To Make Connection To WordPress Data Base In A Plugin?
- Alter query on edit.php
- Changing user_nicename
- WordPress will not operate correctly
- count number of user comments with a specific comment meta value
- tag search using WP_Query
- Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- How to track a users progress through pages by inserting data into WordPress Database?
- if statement on database query
- Is the regular ajax request method safe or I should use admin-ajax.php?
- my function doesn’t return my post from today
- Sortable admin column for one meta key with three possible meta values
- Enhanced WordPress Search
- WordPress Ajax Custom Query – High CPU LOAD
- AJAX in WordPress, sending coords data to MySQL and show after into map
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- Styling images coming from another blog
- mysqli_real_connect() – authentication method unknown to the client Warnings
- Do I need to prepare query before get_results(), get_row() and get_var()?
- How to convert objects into arrays
- Ajax $wpdb not returning table data
- Is there a way to get 3+ dimensional array from a single MySql command
- Get stock by custom meta field on all Woocommerce variable products
- Display fields as values in array from external SQL DB
- Can’t get wp_insert_post to work
- mysql query from wordpress page using custom table
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- SQL Injection blocked by firewall
- How to check if a meta value has already been assigned to any user?
- Long running queries
- Not connecting to database in file with multiple MySQL connections
- Way to bulk make all my tags lowercase?
- $Wpdb post meta query is not working with mutliple meta keys and values? [closed]
- Custom array from a query only write the last row of the query
- php include not working in custom page
- email alert for product availability
- Issue with fetching mysql data and displaying results via shortcode in webpage
- Custom route and query
- How do I prepare strings for insertions as values into a MySQL table?
- add category to posts with tag wordpress
- How can I Use 2 databases with one WordPress install
- Edit Account – read and write to MySQL
- Why won’t this wpdb get_results query return results?
- Why when I create a new post I found 2 record related to this post into the posts database table?
- Most viewed posts in WordPress
- wordpress sql posts query won’t display the latest post in a specific category
- Display latest post from WordPress Featured Category that is also in X,Y,or Z categories
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- What’s wrong in my PHP code? I’m using WordPress Astra Theme and I can’t insert data into my SQL
- WordPress low speed after migrating to new host
- Get mysql data for Quick Edit panel
- Fetch Data from an external MSSQL Database in a Managed WP hosting
- AWS Lightsail WordPress – connect to database on instance using mysqli
- call to undefined function mysql_connect
- Using wpdb to connect to a different database is not working
- How to edit content in WordPress and the Polylang – plugin? – with demosite
- Change upload URL by mime type
- Unexpected behavior when trying to manually install WordPress on macOS Sierra
- WordPress post insertion from PHP file
- Insert data from form to database
- Prepared DB Query from _POST array
- Where to check in PHPmyAdmin / SQL database for subdomain
- Plugin Modification Change Functionality For Logged User Only
- Can not manually create a database ( db, user, pass ) for a plugin
- How to merge 2 WordPress sites?
- Insert double entry in DB
- Splitting One Big WordPress Site into Multiple Small Sites
- How to export database correctly for local to online
- How to pass username into form that sends data to database
- How to edit the default database of WordPress [closed]
- Your PHP installation appears to be missing the MySQL … After deleting and restarting from cpanel
- Execute multiple PHP Snippets causes error?
- what to do after instlling cyberpanel on VPS
- running an existing WordPress site from Visual Studio Code?
- WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax [closed]
- Help writing out comments and replies
- Updates applied to staging WordPress site affecting production even with different databases
- WordPress Query with meta_key and order by another meta_key