Developer Center

INSERT

The methods required to create a new row in the table in the database are explained below.

INSERT

It written as WDB::insert(arg1,arg2) 

Inserts the data defined in it as a new row in a table.

You must write the table name in the arg1 value. You can define values of "ARRAY" data type to arg2 value. The "column name" must be written in the "index" value of the array.

As the return value, it returns the result of the operation in "ARRAY" data type.

lastID

It written as WDB::lastID() 

After the "INSERT" method runs, if the result is successful, it returns the "ID" number of the related row.

The return value is returned as "INT" data type.

Sample PHP Code

<?php
    $set = [
        'field1' => 'pear',
        'field2' => 'fruits',
        'field3' => 'sugar',
    ];
    $insert = WDB::insert("table1",$set);
    if($insert)
    {
        echo "Successful";
        echo "ID: ".WDB::lastID();

    }
    else
    {
        echo "Error : ".$operation->getErrorMessage();
    }
    
?>
Create a Query UPDATE

Do you have any questions?

Feel free to contact us
Contact Us
Copyright © 2024. All Rights Reserved.
Join Our Discord Channel
Top