Hey guys I was wondering how I would get the highest id in wordpress. So for example I have a database that a guest will check out and if they check out each time with the same email address I want it to grab the highest id becuase the highest id would be the most recent entry.
Code:
$id = $wpdb->get_var( $wpdb->prepare(
"
SELECT ID
FROM wp_discount_info_guest
WHERE email = %s
",
$email
) );
I get the value 2 because in the database field id 2 holds the email that is stored in the var $email
So I want it to grab the highest id value if there is another entry because that would mean the highest id is the most recent.
Let me know if you need more.
thanks!