$wpdb->query() vs. $wpdb->get_results() vs. phpMyAdmin

The difference is what is returned.

The WPDB query() method returns true for CREATE, ALTER, TRUNCATE and DROP queries, an integer of how many results for all other queries, or simply false if if there’s an error.

The WPDB get_results() method actually returns the entire result of the query (like you would get running the query in phpMyAdmin). You can return the result as an array or an object, depending on how you want to work with the results.

error code: 523