/ LJCPHPCodeDoc / LJCDataManagerLib / LJCDataManager / Add


Parameters
$dataColumns - The data columns.

Returns

The count of affected records.

Syntax

PHP
public function Add(LJCDbColumns $dataColumns) : int

Adds the record for the provided values.

Remarks

The Add() method uses the values from the $dataColumns collection parameter to insert a record into the database.

Example

PHP
 $webCommonPath = "c:/inetpub/wwwroot/LJCPHPCommon";
 require_once "$webCommonPath/LJCDataManagerLib.php";
 require_once "$webCommonPath/LJCDBAccessLib.php";
 
 // See constructor for how to create $connectionValues.
 $tableName = "TableName";
 $manager = new LJCDataManager($connectionValues, $tableName);
 
 $dataColumns = new LJCDbColumns();
 $dataColumns->Add("Name", value:"NameValue");
 $affectedCount = $manager->Add($dataColumns);
 
 // $manager->SQL =
 // insert into TableName
 //  (
 //   Name
 //  )
 //  values
 //  (
 //   Name = 'NameValue'
 //  )

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.