Why is an empty result an error? ( $wpdb->get_row )
I have a query where I get the highest id from a table.
$user_id = $wpdb-get_row("SELECT * FROM $table WHERE id=(SELECT MAX(id) FROM $table)")
The table should always have rows, but if for some reason it returns empty, there is an error (printed with $wpdb-print_error()
):
WordPress database error: []
I was wondering why an empty result means an error? And how would I prevent this error?