Thanks all, I got it
I changed the code to be
$SQL = "SELECT * FROM
".$wpdb->prefix."orderdata
WHERE cus_id='".$userdata->ID."'
GROUP BY order_id
ORDER BY autoid DESC";
$results = $wpdb->get_results($SQL);
That solved the issue
Related Posts:
- Undefined function mysql_connect()
- Fatal error: Call to undefined function mysql_connect()
- MySQL “Or” Condition
- the_date() not working
- How to return number of found rows from SELECT query
- Transaction when using WP functions rather than vanilla SQL?
- How to make WordPress plugin check for database changes and then do something?
- Custom SQL query to get List of posts with featured image url
- Jquery ajax to custom php file: returning blank data
- Add value to usermeta without removing previous values?
- Problems migrating WordPress to localhost
- How can I call a row of user specific data from a custom table added to the WP Database
- How to merge local and live databases?
- Successful or Error Message after running mysql code in functions.php
- Performance issues with large website [closed]
- Create a quick start wordpress installation [closed]
- theme options echoing multiple times
- PHP/MySQL issues when running WP on EC2 cloud [closed]
- WordPress 3 – how are passwords stored and how do I compare to them?
- WordPress get pagination on wpdb get_results
- How to create another version of my site based on the same database
- how to echo all tables that start with a prefix
- Looking for most performant way to execute several similar WP queries within shortcodes
- How to select WooCommerce products by post_meta and order them
- Stumped on migration
- PHP code inside shortcodes
- Show MySQL errors that occur when I excute $wpdb->insert()
- Is XAMPP faster than running LAMP in WSL on Windows 10? [closed]
- Remove one value in dismissed_wp_pointers?
- WordPress Site Running Extremely Slow on Dedicated Server
- Accessing data from a non-WP database/table within a page content
- Get updated query results on page after insert in database
- WordPress not reflecting changed of the database
- How can I fix WordPress installation errors?
- How can I save unique user data on my site? [closed]
- Ordering users by custom user meta
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Hacked WordPress website /Homepage redirect [closed]
- Refresh table data with Ajax
- Database query works fine outside WordPress
- Large Woocommerce Site (83,000 items), What Can I Do? [closed]
- Using custom tables for old posts
- Multiple meta_key in one global $wpdb;
- Custom array from a query only write the last row of the query
- WordPress member notification
- Can’t Query Custom Table Using $wpdb Method
- Moving wordpress site from localhost to live server using GoDaddy cPanel
- How does WP work in conjunction with a web server?
- WordPress Block developer from exporting Database via PHP
- Update postmeta after theme switch
- Location of core code for database connection and get_header
- How do I display offsite database info on my wordpress site?
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- Most commented posts by time period (last 12h, last 24h and etc)
- Use $wpdb or other PHP script method to find/replace in WP database
- Issue with fetching mysql data and displaying results via shortcode in webpage
- Hide posts if user is added to it WP_query
- Custom route and query
- How to unserialize data from MySQL
- WordPress WP_Query without query GET parameters
- Known Issues in WordPress When Upgrading PHP to ver 7
- Edit Account – read and write to MySQL
- Get the id of the row from database on click of a button [closed]
- Why when I create a new post I found 2 record related to this post into the posts database table?
- mySQL queries are executed twice on wordpress website
- Query the links Database
- Most viewed posts in WordPress
- SQL error with custom query
- Modify WooCommerce used to get all orders in dashboard
- What’s wrong in my PHP code? I’m using WordPress Astra Theme and I can’t insert data into my SQL
- Get mysql data for Quick Edit panel
- Display Results of SQL Query on WP site
- Weird fonts showing which are coming from database
- Inside Array – “unidentified index” error with “prepare was called incorrectly” despite not calling the prepared statement with wordpress [closed]
- WordPress Bad Request Error 400
- I am facing this error Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- How to display MySQL table data which is stored as an array?
- What is the correct way to search 3 custom fields only in WordPress?
- cant insert data in a custom table in phpmyadmin
- Change upload URL by mime type
- autocomplete in wordpress using ajax with json-data
- Unexpected behavior when trying to manually install WordPress on macOS Sierra
- WordPress post insertion from PHP file
- New database entry to trigger runing PHP/SQL query through link with token, without logging into the website
- Query doesn’t display text data with apostrophes
- I want show only data for today
- Rewrite SQL query as a prepared statement and use in foreach loop
- SQL Query Search page
- Include a custom field in mysql query
- MySQL queries in WordPress
- retrieve wordpress post-meta using php not wordpress functions
- Let users register weight each day and save it in DB
- How to pass username into form that sends data to database
- Your PHP installation appears to be missing the MySQL … After deleting and restarting from cpanel
- How to set variable to specific field when querying
- How to get a database field value from a WordPress table? [closed]
- Getting invalid user ID error when creating a new user with wp_insert_user
- Custom form that stores data in mysql database
- Error resetting database index using ALTER TABLE in $wpdb->query
- Trying to GET data with ajax from database and show in fullcalendar