In a comment you clarify:
what i meant by running is going to the url
(mysite.com/wp-content/plugins/myplugin/checkrank.php?id=1)
In that case, you are running a standalone file.
Yes, one that resides inside WordPress’ plugins folder, but you don’t access it in the context of WordPress (i.e. from within it). Here, none of the WordPress core functions/methods/classes will be available, because they are simply never loaded.
Related Posts:
- How to return number of found rows from SELECT query
- Can i use php sql functions instead of $wpdb?
- $wpdb->get_results(…) returns empty array despite correct query
- $wpdb->delete column values IN ARRAY()?
- wpdb::prepare was called incorrectly
- Custom query to get post names beginning with a digit
- queries inside of a class
- How to display only first value of database column in WordPress
- Print out WordPress user ID – two sites with same code but different output
- WPDB: how to get the value of a field in a custom database table
- Can’t use get_results() in ajax query
- PHP syntax error when using wpdb update?
- “The plugin generated 2694 characters of unexpected output…” on Plugin activation, CREATE TABLE sql command not working
- Export WordPress Table to CSV from page
- WordPress get pagination on wpdb get_results
- $wpdb->flush(); breaks the loop
- Call External Object in Class Function During Callback
- Show MySQL errors that occur when I excute $wpdb->insert()
- Get stock by custom meta field on all Woocommerce variable products
- Any possible way to make $wpdb->get_results() return anything else than array?
- database interactions using OOP
- how to delete 30 day old data using PHP [closed]
- Echo a hierarchical list of post data from custom fields
- 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
- I want to select the from values from database in WordPress? [closed]
- Querying wpdb using PHP
- Update results, Before deleting the related category [closed]
- How WordPress reacts to a lack of memory of the server [closed]
- wpdb php get_var query to get ID for URL image doesn’t work for ID over 999
- Database query works fine outside WordPress
- $wpdb->insert() does not Insert record in a table
- Help with a $wpdb MySQL Query
- Fatal error: Call to a member function query() on a non-object
- Custom array from a query only write the last row of the query
- Querying Database with wpdb
- $wpdb returns duplicate posts
- Mixing variables into an array when inserting values
- Wpdb->insert() doesn’t insert new row after the last one
- 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?
- How to get specific attribute from DB
- wpdb Cannot Update column in Database
- How to use mysql LIKE with wpdb?
- PHP -> SQL Query with Summing
- How to insert wp_users ->user login name to wp_terms when a new user registering?
- Delete database record using plugin from admin panel
- How do I prepare strings for insertions as values into a MySQL table?
- How to use AJAX in WordPress in MYSQL query?
- Change MySQL PDO connection to a WPDB connection
- WPDB – Read and write value from / to database
- $wpdb->get_results breaking page?
- Why my query does not run with prepare
- How to Generate a list of Most Commented post?
- Why won’t this wpdb get_results query return results?
- WPDB secure custom form
- WordPress SQL JOIN query
- Query the links Database
- Fetching review value using wpdb class
- MySQL Query Returns Array () In Shortcode
- WordPress get last inserted user id
- Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}
- Passing in MySQL prepare statement parameter separately throwing error
- Convert a column of a table containing an Array as response in HTML
- Database SQL query error
- WordPress SQL Prepare
- MYSQL TIMESTAMP when adding DATE_FORMAT then the output is blank, PHP conflict?
- Conditional formatting on data fetched from MYSQL
- What is the correct way to search 3 custom fields only in WordPress?
- Modify post image in full size
- 403 Forbidden WordPress Database Results
- problem in using wpdb->prepare and a string placeholder
- Rewrite SQL query as a prepared statement and use in foreach loop
- How to return count of items found in SQL query
- Advanced WordPress SQL Query
- MySQL query in WordPress with AJAX
- Accessing external database: ERR_INCOMPLETE_CHUNKED_ENCODING
- MySQL queries in WordPress
- Order by in foreach
- How to fetch results from database
- At what point during a typical request does the $wpdb object become available?
- Using the same shortcode to show any table from the database
- AJAX with Selectbox Plugins (Select2, Chosen, Selectize)
- Get null from POST
- 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 display inputted data in Ajax without button or click event
- inner-wrap div pushing custom table far down on page
- use wpdb object on other file
- How to get data (not value or name) from radio options to POST to database
- I have an error WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version
- Warning: Undefined property: wpdb::$question_overview in C:\Wamp.NET\sites\proxyvragenmodule\wordpress\wp-includes\class-wpdb.php
- Putting form result in my database
- SQL – How to echo out inside of where statement
- How can I update a value of a field depending on outside source?
- Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
- get_var not returning a value when the field contains an apostrophe
- How to connect wordpress with db using ssl client certificate