My issue was resolved, not sure if the connection to the database will work, but the error with wpdb connection was fixed. It was quite easy fix once I found out what the file dependence was. This is what you need to do:
In the file you are trying to use wpdb you need to add code before you can use the class:
<?php require_once('../../../wp-load.php'); ?>
Note* You may need to change how far back in the directory you go depending on your install or depending on the location of your php template/file.
It should run wpdb without any errors.
Related Posts:
- How to insert a single row to WP database table?
- How to return number of found rows from SELECT query
- $wpdb->delete column values IN ARRAY()?
- WPDB: how to get the value of a field in a custom database table
- Prevent Data Resubmission On Page refresh
- Any possible way to make $wpdb->get_results() return anything else than array?
- database interactions using OOP
- Display fields as values in array from external SQL DB
- Getting id of poll from WP database
- WSoD being caused by this piece of code
- $wpdb->update with multiple parameters gives error
- Update results, Before deleting the related category [closed]
- How WordPress reacts to a lack of memory of the server [closed]
- Display Data in Table from External Database in WP using Shortcodes
- How to retrieve the data from the sever and displaying it in a page?
- I can’t update my data through $wpdb
- wpdb Cannot Update column in Database
- How to use mysql LIKE with wpdb?
- Delete database record using plugin from admin panel
- Wpdb get->results to out the the month from the db
- How to add data to a custom field at the wp_users table?
- Change MySQL PDO connection to a WPDB connection
- WPDB – Read and write value from / to database
- How to Generate a list of Most Commented post?
- Add row to custom database Table and delete all rows older than 1 day
- select a single val though a table in wordpress
- SQL error with custom query
- Add posts to custom table in database instead of wp_posts
- Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}
- Database entry removed on browser refresh, Ajax PHP jQuery
- Change wordpress’ database data using ajax – how to get current user id?
- Create a new account on site B with data from the purchase of site A
- Using wpdb to connect to a different database is not working
- Modify post image in full size
- How to grab data from input and store it into custom table in database?
- Accessing external database: ERR_INCOMPLETE_CHUNKED_ENCODING
- Weird Behaviour: Not all WordPress Posts appearing
- How to fetch results from database
- Check if values exists DB
- Querying multiple meta_keys in WordPress SQL query
- MySQL database migration to WordPress
- Fetching wpdb data from a php file seems to break?
- Insert into db with foreach problem
- posts_clauses drop ACF get_field function
- How to get data (not value or name) from radio options to POST to database
- Putting form result in my database
- How do I change/modify the_post_thumbnail(); html output?
- Counting number of posts in a category and its sub categories and displaying result using shortcode
- Shortcode created to check language not works
- Retrieving and Displaying Data From a Table
- Listing all sub-pages?
- How can I default to all WordPress roles when parameter is not included in shortcode?
- Export WordPress Table to CSV from page
- Recent post display using shortcode
- How to speed up a wordpress function with multiple loops?
- How can I use wp_insert_comment to write a comment when a post is edited?
- Conditional Header in wordpress
- Menu — How to add “current-menu-grand-ancestor” css class
- functions.php is being included twice, creating PHP fatal errors
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- Accessing the database from a plugin outside of action hooks
- Fatal error: Uncaught Error: Call to undefined function test()
- Return a numerical function value in Customizer controls
- How can I get the values of my WordPress $wpdb query in Jquery?
- theme_root returning a truncated URI
- Echo string and function?
- Adding wrapper elements in the_date() like in the_title()?
- Notify users only on post publish
- Plugin Generate Unexpected output during activation
- Issue running db create table query from static method
- PHP code for displaying WordPress posts in a static page not working
- Can’t successfully check if post with title exist in database
- Output: “Array”
- Filter results from a serialized string to use on statistics
- How to make a cookie be on the whole site instead of being on a specific page/
- Child Theme’s Read More Text
- wpdb getting avatars and author url
- call a string/function from database
- Get date function not working
- How a HTML form can trigger a PHP function?
- Allow a user or role to view drafts and previews, but not other admin privileges?
- Get current user id in function php
- Proper way to remove html code on child theme
- Trying to add Custom Post Type to this functions.php command
- Apply function.php filter only if url not has /amp/
- Preventing direct access to a page in WordPress
- Display a custom name when the user has no name settle in his account
- How to link all featured images to custom url in single.php for only non-logged-in users?
- custom post type column countdown
- Creating wordpress user registration form
- Add missing alt tag to featured images for “storefront” theme
- Load admin bar without wp_head or wp_footer [duplicate]
- My query keeps looping infinitely ! how to stop it?
- Highlight Single Page Ancestor
- Registration form not registering First and Last name
- Removing get_template_part in child theme
- How to connect database table to each registered wordpress user.
- AJAX with Selectbox Plugins (Select2, Chosen, Selectize)
- How to get the rating value of each comment
- Error in php code