Abubakar Abubakar - 3 years ago 83
MySQL Question

How to check if new rows is insert in specific table

My table name is pm. I have two questions.

  1. How can I check if new rows is insert this table(using wpdb query)?

  2. How to get the inserted rows from table (using wpdb query)?

Sam Sam
Answer Source
$wpdb->insert('table', $arrayData); 

this will return true if it successfully added to your table and false if failed to add to table due to some error in query

to get the last inserted record id you can use


which will return last record's id

more details on $wpdb is here https://codex.wordpress.org/Class_Reference/wpdb#INSERT_row

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download