How to Get Last ID?

I am developing a plugin for wordpress. I have created table in SQL for export ID. I need to call back this ID by adding 1. The code I use is as below

This is how I query the ID in SQL table.

    global $wpdb; $last_id = $wpdb-get_var( 'SELECT id FROM ' . $wpdb-prefix . '_bek_exports' . ' ORDER BY id DESC LIMIT 1');

This is how I use it in the code below

if ( $export_id == (++$last_id) ) {

UPDATE

I solved the problem. If you want to use it, it is written below.

$last_id = $wpdb-get_var( 'SELECT id FROM ' . $wpdb-prefix . 'bek_exports' . ' ORDER BY id DESC LIMIT 1 ');

When you write as in the code, it takes the last id created.

Topic mysql plugin-development export Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.