PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.16.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.16.2
V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 2.10.2 All 137 releases
← All changes | includes/Core/Database/Model.php +10 -3 2.10.22.16.2 View file →
@@ -475,13 +475,20 @@
475 475 $this->app_db->flush();
476 476 return $response;
477 477 }
478 478
479 - // get last entry id
479 + /**
480 + * Get last inserted id
481 + *
482 + * @return int
483 + */
480 484 public function lastId()
481 485 {
482 486 $sql = "SELECT id FROM {$this->table_name}
483 487 ORDER BY id DESC LIMIT 1";
484 - $result = $this->execute($sql)->getResult()[0];
485 - return $result->id;
488 + $result = $this->execute($sql)->getResult();
489 + if (is_wp_error($result)) {
490 + return 0;
491 + }
492 + return $result[0]->id;
486 493 }
487 494 }