get last inserted id from wordpress $wpdb

I would like to get last inserted id after $wpdb->insert().I got a solution with $wpdb->insert_id(); but unfortunately which retrieves the primary key plus an additional zero. ie, consider my primary key (or inserted id) is 2 $wpdb->insert_id(); retruns 20 .whats wrong with this method?anybody can please help me.


The insert_id is a property, not a method. Try it without the () at the end, see what you get.

Need Your Help

An example of how to use getopts in bash

bash shell getopts

I want to call myscript file in this way:

ActionBarSherlock library is full of errors after being imported

java android actionbarsherlock android-actionbar

Okay, I'm trying to get ActionBarSherlock working, so I imported the library by: