Return inserted row ID in wordpress wpdb

admin

Administrator
Staff member
I want insert some data to a table of the wordpress then return it's auto increase id value.

I do this but both of these has error:

Code:
INSERT INTO wp_sho_app_form (job_id, first_name, last_name) VALUES(1, 'Caldwell', 'Estrada'); 
SELECT LAST_INSERT_ID();

This code word well in MySql but by
Code:
$wpdb
I get this error:

<blockquote>
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'SELECT LAST_INSERT_ID()' at line 1
</blockquote>

I call this statement by
Code:
$wpdb-&gt;query
and also
Code:
$wpdb-&gt;get_results
, but both of them has that error.
I don't want use
Code:
$wpdb-&gt;insert
for some reasons and I should use this type of code.