You’re adding an extra wp_
prefix to your table and your using a timestamp instead of a MYSQL datetime. Below is how WP suggests you use $wpdb->query
to delete rows, taken from the codex.
EDITED
global $wpdb;
$wpdb->query(
"DELETE FROM " . $wpdb->prefix . "userinfo
WHERE timeall < DATE_SUB(CURDATE(),INTERVAL 30 DAY)"
);
$wpdb->prefix
adds the wp_
for you.
Related Posts:
- $wpdb->get_results(…) returns empty array despite correct query
- WPDB: how to get the value of a field in a custom database table
- Get stock by custom meta field on all Woocommerce variable products
- Display fields as values in array from external SQL DB
- Querying wpdb using PHP
- $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?
- PHP -> SQL Query with Summing
- Why my query does not run with prepare
- wpdb getting avatars and author url
- WordPress SQL JOIN query
- Fetching review value using wpdb class
- Database SQL query error
- WordPress SQL Prepare
- Creating multiple tables with Plugin
- Querying multiple meta_keys in WordPress SQL query
- Can’t send form data to wpdb when URL has query string
- Can i use php sql functions instead of $wpdb?
- wpdb::prepare was called incorrectly
- Display data from a non wordpress database on a page template
- How to get the list of WooCommerce product image of a certain category from database?
- Custom query to get post names beginning with a digit
- Alter query on edit.php
- How to auto login user again after change user_login
- How to Join two tables from separate databases within WordPress
- count number of user comments with a specific comment meta value
- PHP syntax error when using wpdb update?
- my function doesn’t return my post from today
- Enhanced WordPress Search
- “The plugin generated 2694 characters of unexpected output…” on Plugin activation, CREATE TABLE sql command not working
- register_activation_hook isn’t adding table to DB
- How to generate page content from database the right way?
- Ajax $wpdb not returning table data
- Converting MYSQL to WordPress $WPDB
- How to Fetch values from WP database based on selected option value by onchange using PHP?
- phpMyAdmin displays error when importing database
- Preferred Method of debugging a wordpress SQL calls?
- Transferring working local PHP site to wordpress – with database (MySQL)
- Echo a hierarchical list of post data from custom fields
- Can’t get wp_insert_post to work
- Getting id of poll from WP database
- How to insert a single row to WP database table?
- I want to select the from values from database in WordPress? [closed]
- Importing Geo data into wordpress database
- Detect session/cookie variable in wordpress to prevent access to documents
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- wpdb php get_var query to get ID for URL image doesn’t work for ID over 999
- Archive post by meta value + 24hours
- Help with a $wpdb MySQL Query
- Custom array from a query only write the last row of the query
- Querying Database with wpdb
- $wpdb returns duplicate posts
- Wpdb->insert() doesn’t insert new row after the last one
- How to get specific attribute from DB
- wpdb Cannot Update column in Database
- How to insert wp_users ->user login name to wp_terms when a new user registering?
- How do I prepare strings for insertions as values into a MySQL table?
- Change MySQL PDO connection to a WPDB connection
- WPDB – Read and write value from / to database
- $wpdb->get_results breaking page?
- How to Generate a list of Most Commented post?
- Why won’t this wpdb get_results query return results?
- mySQL queries are executed twice on wordpress website
- Call to a member function get_row() on a non-object, Unable to use global $wbdp inside a plugin
- Query the links Database
- Remove password protection from all posts
- 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
- WordPress get last inserted user id
- Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}
- Fetch Data from an external MSSQL Database in a Managed WP hosting
- Run a sql (update) after 12 hours after the user login. Woocommerce users
- What is the correct way to search 3 custom fields only in WordPress?
- Using wpdb to connect to a different database is not working
- Looping through custom data in a custom table to display all items in a post
- Rewrite SQL query as a prepared statement and use in foreach loop
- How to return count of items found in SQL query
- Getting error in sql query
- Where to check in PHPmyAdmin / SQL database for subdomain
- Plugin Modification Change Functionality For Logged User Only
- SQL Query Search page
- Accessing external database: ERR_INCOMPLETE_CHUNKED_ENCODING
- Conditional statement within WP SQL query
- Run insert if no entry otherwise run update with ajax
- Can not manually create a database ( db, user, pass ) for a plugin
- How to merge 2 WordPress sites?
- At what point during a typical request does the $wpdb object become available?
- Get null from POST
- How to export database correctly for local to online
- MySQL database migration to WordPress
- Insert into db with foreach problem
- posts_clauses drop ACF get_field function
- inner-wrap div pushing custom table far down on page
- 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
- SQL query to retrieve the number of WordPress posts with all given categories
- 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?