You have a problem with your query which is you can’t use GROUP BY
and ORDER BY
before WHERE
replace
FROM tablename GROUP BY submit_time ORDER BY submit_time DESC
with
FROM tablename
This is your query
$results = $wpdb->get_results( 'SELECT DATE_FORMAT(FROM_UNIXTIME(submit_time), "%b %e, %Y %l:%i %p") AS Submitted,
MAX(IF(field_name="Name", field_value, NULL )) AS "Name",
MAX(IF(field_name="Email", field_value, NULL )) AS "Email",
MAX(IF(field_name="Subject", field_value, NULL )) AS "Position",
MAX(IF(field_name="Message", field_value, NULL )) AS "Message"
FROM tablename
WHERE
form_name = "Resume"
GROUP BY submit_time
ORDER BY submit_time DESC', ARRAY_A);
Related Posts:
- $wpdb->get_results in not an array
- Fetch array with $wpdb
- Create an array with a string key from wpdb->get_results
- Undefined offset: 0
- Save data from a checkbox to a wpdb array
- MySQL Query Returns Array () In Shortcode
- Convert a column of a table containing an Array as response in HTML
- PHP | left join avg query give me Array()
- Access to numerically indexed array in wpdb Class and undefined offset
- Get 3 row ID’s via ARRAY_A
- Echo only gives me the first part of string
- wpdb select from using array as search parameters
- wpdb Cannot Access Associative Array Data in a Count Query
- Can’t seem to get set_blog_id working, it just doesn’t reset the blog ID
- How do I check for a duplicate record before inserting using wpdb
- passing variables as parameters to stored procedures via wpdb from php-script
- post__in – Placing content from a foreach loop inside of an array
- $wpdb->query() multiple query support
- Set media metadata (i.e. “dimensions” field) on SVG file after extracting it with a filter
- Need to get specific data from array
- how to execute different sql query in non-sanitized $wpdb->get_results function
- $wpdb not returning data
- $wpdb Query Result not coming but in phpmyadmin it works [closed]
- Join inside a wpdb query.. confused!
- Must Use Plugin Causing Query Error
- How to convert objects into arrays
- Ajax $wpdb not returning table data
- Admin Options page. Save as Array
- Fixing wpdb->get_results and wpdb->prepare?
- How does the WXR file differ from the WPDB?
- Rolling Back from current WordPress version to previous one
- PHP get the first post separately from array returned by wpdb->get_results()
- How can I add multiple ‘tax_query’ arrays via a loop?
- How to properly loop through these external URLs to get them into the sitemap using this hook
- Can’t get wp_insert_post to work
- How to insert a single row to WP database table?
- using $wpdb to insert a form into a post
- wp_create_user not properly entering password
- foreach loop still echoes array
- Foreach loop not working as expected – custom tables and references while submitting a form
- Query insert query executing multiple times
- Connect to separate database using $wpdb and authenticate user
- How to access PostgreSQL using WPDB?
- how to use $wpdb->prepare to update a custom table
- Creating a post from data returned from HTML form
- How to write: $wpdb->update having WHERE NOT value pair in the array
- how to assign content to a different author while loading content
- Create menu locations for each category in wordpress
- Custom array from a query only write the last row of the query
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- Add first letter of titles to array, then compare arrays
- Output meta into arrays
- How do I turn these values from MYSQL into an array
- How do I create a numbered list with PHP? [closed]
- Get categories names as an array to use it in theme settings
- Register custom table for WP to use in a plugin
- Warning: in_array() null given in PHP function
- wpdb->get_row is selecting the variable as a column name
- wpdb Cannot Update column in Database
- Display category names on edit user profile using $wpdb
- How do I prepare strings for insertions as values into a MySQL table?
- Do not replicate items if they exists in a foreach loop
- How can I split my query result in 2 arrays?
- Dynamically adding filters
- WPDB – Read and write value from / to database
- Order a WP_Query by meta value where the value is an array
- wpdb and acf via wp rest api
- WPDB SQL Ignore `post_status` Parameter
- How to Generate a list of Most Commented post?
- Why won’t this wpdb get_results query return results?
- wpquery properties last_query and last_result : should these be public or private?
- Using multiple variables to assign categories to an array
- Repeat a function with 24hrs gap for n number of days
- See if the email exists or not
- wpdb->insert with special chars failing with collation utf8mb4_unicode_520_ci
- 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
- WP post meta – for loop inside for loop
- Store custom field’s multiple values in one user meta key
- Debugging db calls: $wpdb->insert works on test site, not on identical production site
- Trouble with checked() for array of multiple checkboxes
- wpdb get_row database query inquiry
- Depreciated Call -> Function wpdb::escape()
- How do I update post based on meta_key in another table?
- WP_Post is not from correct array
- Run insert if no entry otherwise run update with ajax
- Inserting and updating rows with wpdb indreases integer fields by 1 point sometimes
- Retrieve a list of users based on some conditions
- wp_commentdata: error in documentation?
- Adapting a php array to WordPress
- wp-postratings: list current user’s unrated posts
- MySQL database migration to WordPress
- Error inserting row into table
- Retriving array size from serialized data
- What is this mark for “? function()” [closed]
- How to combine array info [closed]
- get only 1 wpdb and get taxonomy, post to next page [closed]
- get_body_params() is always empty in POST request
- Grabbing value of input field inside of array
- Can’t send form data to wpdb when URL has query string