Call to undefined method rowInserted() (v2022)

i am inserting records.

function Row_Inserted($rsold, &$rsnew)
{
    // Get the last inserted ID
    $lastInsertedID = $rsnew->getLastInsertID();

    // Retrieve the last record from the regist_newstd table
    $lastRecord = ExecuteRow("SELECT * FROM regist_newstd WHERE sno = $lastInsertedID");

    // Check if a record is found
    if ($lastRecord) {
        // Concatenate the values from the last record
        $message = $lastRecord["name"] . $lastRecord["fname"] . $lastRecord["testlevel"];
        $mobile = $lastRecord["ph"];

        // Insert a new record into outboxwhatsapp
        ExecuteStatement("INSERT INTO outboxwhatsapp(mobile, status, message) VALUES('$mobile', '2', '$message')");
    }
}

debug information:
[2023-12-08T16:07:39.642110+00:00] log.DEBUG: Slim Application Error Type: Error Code: 0 Message: Call to undefined method PHPMaker2022\smdiary\RegistNewstdAdd::rowInserted() File: C:\xampp\htdocs\portal\models\RegistNewstdAdd.php Line: 1467 Trace:
#0 C:\xampp\htdocs\portal\models\RegistNewstdAdd.php(595): PHPMaker2022\smdiary\RegistNewstdAdd->addRow(NULL)
#1 C:\xampp\htdocs\portal\controllers\ControllerBase.php(50): PHPMaker2022\smdiary\RegistNewstdAdd->run()
#2 C:\xampp\htdocs\portal\controllers\RegistNewstdController.php(20): PHPMaker2022\smdiary\ControllerBase->runPage(Object(Slim\Http\ServerRequest), Object(Slim\Http\Response), Array, ‘RegistNewstdAdd’)

There is no $rsnew->getLastInsertID().You should use Conn()->lastInsertId() instead.

Where i will changes

Double check your code at this part:

function Row_Inserted($rsold, &$rsnew)
{
    // Get the last inserted ID
    $lastInsertedID = $rsnew->getLastInsertID();
...

ufone wrote:

Call to undefined method PHPMaker2022\smdiary\RegistNewstdAdd::rowInserted()

The error said PHP cannot find the rowInserted() method. Make sure you generate all files for the table “RegistNewstd” again after adding your server events. Your Row_Inserted server event is generated in RegistNewstd.php (not in the RegistNewstdAdd.php).

In addition, make sure you do not add your code into the generated .php script files manually. You should add your code in the related server event from the PHPMaker project side. After that, make sure you have already re-generated ALL the script files before trying it again.