Assuming you have table that’s prefixed with the WordPress prefix (even if it’s not the default one), and the table is called table
. Then the following code should select everything, and allow you to go through each row. In this example, it goes through each row and outputs the content of the field foobar
.
global $wpdb;
$results = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."table");
foreach ( $results as $row )
{
echo $row->foobar;
};
See the Codex page on $wdpb
Related Posts:
- Prevent WordPress from loading comments
- Adding a Table to the wordpress database
- Fastest way to get the comment and ping total count for a post
- What is my error trying to create a new table in the database?
- Database custom table issues – incorrect result displayed
- Backup the Database and Restore from the Backup?
- Need help with friendly URL’s in WordPress
- When is it appropriate to create a new table in the WordPress database?
- difference between esc_attr(), strip_slashes(), strip_tags()?
- How To Make Connection To WordPress Data Base In A Plugin?
- Creating search form for custom database table
- Get the sidebar ID in which the current widget was dropped
- Getting $comments outside the comment template
- media_handle_upload weird thing
- Search and Replace in database: How to replace data in SQL dump file on Windows?
- Can I use $wpdb for my custom tables in the WordPress database?
- Comment filtering (search)
- What Is The Difference Between suppress_errors() And hide_errors() in $wpdb?
- Suggestions for WPMU Migration (advanced)
- Retrieve and display data from custom db table in admin area?
- How to find if a post with custom_field == X exists?
- Custom search page and search by title, content and tag
- Get multiple db prefix with $wpdb
- WP_Query with the “offset” argument
- How can I add data to a custom column in the Users section of the wordpress backend?
- Add filename to attachment page url
- Count widgets of a certain type
- Widget Javascript code (ajax)
- What’s the proper way to use a custom table? [closed]
- How to retrieve the value stored in a multi-dimensional array and SUM the entries?
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- Creating user relationships
- WP Northwind for Theme Development?
- database interactions using OOP
- Get Value from Column in Plugin Table [closed]
- Accessing data from a non-WP database/table within a page content
- Author Tracking Code!
- want to create a subcategory.php to manage subcats
- The function can not create a table on MariaDB server
- $wpdb->replace: WHERE?
- Creating custom database table with crud operation
- How to use default WP form elements to interact with custom DB table?
- Your thoughts on the interaction with one custom database table from WP?
- dbDelta not creating tables with composite keys
- Applying WP-cli Search & Replace to Static SQL Dump File
- Saving contact form 7 data into custom Table
- How to make wordpress use a non-wordpress users table?
- Setup database structure with books, authors, languages etc. for publishing house [closed]
- Gravity Forms – gform_field_value – query custom table breaks functions.php
- Add table to WordPress database
- Comment “like” problem – “users who like this” avatar linking to current user profile instead of “liker’s” profile
- Custom select query two tables by a meta key
- How to use multiple check-box values to work in a function and insert values in database
- optimal taxonomy or custom post types
- WordPress search on a custom table
- Get All Results From Other Users That Share The Same Custom User Meta As Current User
- Migrating my site to a new domain does not keep any changes made in customizer
- New Page/Post Screen Opens an Existing Post
- Advice on how to structure a custom plugin
- How to have differents sites share the same tables of DB?
- Custom Form Input not saving to Database
- data retrieval presents last set of data
- Create single{custom}.php with data in table out of wp_posts
- Accountless password generation
- Add several fields from different tables to post, fields per post are in same row of table
- Insert double entry in DB
- Where should I put this custom data?
- Show WP content on different PHP Sites
- Best way to define a database with product codes and back-end support?
- Edit a custom admin page
- Display single post inside accordion based on form submission results
- Check if values exists DB
- Changing starting number of User ID
- MySQL Engine vs. Charset
- Accessing + retrieving custom database in WordPress
- Custom table or form
- Post thats in Two Categories, only want to display name for one
- Custom Slider Per Page created
- How to get value from wp_usermeta table in database?
- When is it OK to create a custom table for a plugin? [duplicate]
- Advice how to connect custom database with WordPress, change data in WordPress and finaly use this data
- Changes to code not displaying
- Creating a search form in PHP to search a database?
- retrieve data from db and display it in table in php .. see this code whats wrong with it?
- How to create a foreign key in phpmyadmin
- How get value from URL
- How to: Easily Move a WordPress Install from Development to Production?
- Is there a flowchart for WordPress loading sequence?
- MySQL Database User: Which Privileges are needed?
- Essential technical features for high-end WordPress web hosting? [closed]
- How to remove admin menu pages inserted by plugins?
- How to put logs in WordPress
- How to get the Date Format and Time Format settings for use in my template?
- Database synchronization between dev/staging and production
- Should all plugins be encapsulated in a Class?
- Why have on every line
- Where are Additional CSS files stored
- Where are wordpress custom types stored?
- Best Practices for Regression Testing WordPress Websites?
- Remove wrapping div and ul from output of wp_nav_menu