Пример #1
0
/**
 * Delete Rows
 * 
 * @param string $sTab = table name
 * @param array $aData = where
 * @param boolean $gDebug on/off sql statement output
 * 
 * @return mixed $result FALSE or affected rows
 */
function libDbInsertRows($sTab, $aRows, $gDebug = FALSE)
{
    $affected_rows = 0;
    foreach ($aRows as $aData) {
        $result = libDbInsertRow($sTab, $aData, $gDebug);
        $result !== FALSE ? $affected_rows++ : "";
    }
    return $affected_rows;
}
Пример #2
0
} elseif ($i === 2) {
    $result = libDbQueryAllRows($sTab, $gDebug);
}
$sTab = "crm_customer";
$i = 2000;
if ($i === 0) {
    $aData = array("id" => 49379);
    $result = libDbDeleteRows($sTab, $aData, $gDebug);
} elseif ($i === 1) {
    $aData1 = array("UniqueID" => 88888);
    $aData2 = array("UniqueID" => 77777);
    $rows = array($aData1, $aData2);
    $result = libDbInsertRows($sTab, $rows, $gDebug);
} elseif ($i === 2) {
    $aData = array("UniqueID" => 11113);
    $result = libDbInsertRow($sTab, $aData, $gDebug);
} elseif ($i === 3) {
    $aData = array("fname" => 77777);
    $aUpdate = array("id" => 49382);
    $result = libDbUpdateRow($sTab, $aData, $aUpdate, $gDebug);
}
$i = 2;
if ($i === 0) {
    $sqlquery = "select * from {$sTab} where id > 49394";
    $bResult = libDbQueryBySql($sqlquery);
    while ($bResult && ($row = libDbFetchAssoc())) {
        $result[] = $row;
    }
} elseif ($i === 1) {
    $sqlquery = "insert into {$sTab} (UniqueId) values (11112)";
    $bResult = libDbQueryBySql($sqlquery);