/ LJCPHPCodeDoc / LJCDBAccessLib / LJCDbAccess / Execute


Parameters
$sql - The SQL statement.

Returns

The count of affected records.

Syntax

PHP
public function Execute(string $sql) : int

Executes a non-query sql statement.

Example

PHP
 $webCommonPath = "c:/inetpub/wwwroot/LJCPHPCommon";
 require_once "$webCommonPath/LJCDBAccessLib.php";
 
 // See constructor for how to create $connectionValues.
 $dbAccess = new LJCDbAccess($connectionValues);
 
 $tableName = "TableName";
 $sql = "delete from $tableName where ID = 1";
 $affectedCount = $dbAccess->Execute($sql);

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