I'm new to mysql.

I've got this query:

$tenantsInfo = $wpdb->get_results("SELECT * FROM exp_ten WHERE tenant_number = " . (int) $user->ID);

I need to order it by desc; Due to double-quotes I'm not sure where to add order by desc. Can please anyone point me out where should I add it?

Thank you.

$tenantsInfo = $wpdb->get_results("SELECT * FROM exp_ten WHERE tenant_number = " . (int) $user->ID ." ORDER BY DESC");
  • 1
    You are welcome. Remember to use the codex if you get stuck [link]codex.wordpress.org/Class_Reference/wpdb[/link] - Please accept my answer :)
    – lukgoh
    Sep 25 '17 at 14:14
  • Accepted :) but unfortunately I don't have enough reputation so my vote isn't visible, but thanks again:)
    – webhappy
    Sep 26 '17 at 13:53
  • No worries, glad I could help :)
    – lukgoh
    Sep 26 '17 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.