Пример #1
0
echo '<h2>Using getAllByFieldname</h2>';
$stmt = $dbBaseClass->getAllByFieldName('Company', 'Name', 'Protea Security');
if ($stmt === false) {
    die(dbGetErrorMsg());
}
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
    echo $row['Name'] . ", " . "<br />";
}
sqlsrv_free_stmt($stmt);
// Using getFieldsByFieldname
echo '<h2>Using getFieldsByFieldname</h2>';
$fields = array('Name', 'CompanyCode');
$stmt = $dbBaseClass->getFieldsByFieldName('Company', 'Name', 'Protea Security', $fields);
if ($stmt === false) {
    die(dbGetErrorMsg());
}
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
    echo "{$row['Name']} , {$row['CompanyCode']} <br />";
}
sqlsrv_free_stmt($stmt);
// Using getFieldsForAll
echo '<h2>Using getFieldsForAll</h2>';
$fields = array('Name', 'CompanyCode');
$stmt = $dbBaseClass->getFieldsForAll('Company', $fields);
if ($stmt === false) {
    die(dbGetErrorMsg());
}
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
    echo "{$row['Name']} , {$row['CompanyCode']} <br />";
}
sqlsrv_free_stmt($stmt);