/ 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
 // Adds the record for the provided values.
 private static function Add(LJCDataManager $manager)
 {
   $nameValue = "NameValue";
   $methodName = "Add()";
 
   // Add the test data.
   // See constructor for how to create $manager.
   $data = new LJCDbColumns();
   $data->Add("Name", value: $nameValue);
   $affectedCount = $manager->Add($data);
   if ($affectedCount $lt; 1)
   {
     echo($manager->SQL);
   }
   $result = strval($affectedCount);
 
   // result:
   // 1;
 
   // $manager->SQL =
   // insert into Person
   //  (
   //   Person.Name
   //  )
   //  values
   //  (
   //   'NameValue'
   //  )
 }

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