Регистрация Войти
Войти через VK Войти через FB Войти через Google Войти через Яндекс
Войти через VK Войти через FB Войти через Google Войти через Яндекс
Поиск по сайту
Наш чат в Telegram для обмена идеями, проектами, мыслями, людьми в сфере ИТ г.Ростова-на-Дону: @it_rostov
sqlsrv_num_fields
(Информация о версии неизвестна, возможно, только в SVN)
sqlsrv_num_fields — Retrieves the number of fields (columns) on a statement
Описание
mixed sqlsrv_num_fields ( resource $stmt )Retrieves the number of fields (columns) on a statement.
Список параметров
stmt -
The statment for which the number of fields is returned. sqlsrv_num_fields() can be called on a statement before or after statement execution.
Возвращаемые значения
Returns the number of fields on success. Returns FALSE otherwise.
Примеры
Пример #1 sqlsrv_num_fields() example
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT * FROM Table_1";
$stmt = sqlsrv_query($conn, $sql);
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true));
}
$numFields = sqlsrv_num_fields( $stmt );
while( sqlsrv_fetch( $stmt )) {
// Iterate through the fields of each row.
for($i = 0; $i < $numFields; $i++) {
{
echo sqlsrv_get_field($stmt, $i)." ";
}
echo "<br />";
}
Смотрите также
- sqlsrv_field_metadata() - Retrieves metadata for the fields of a statement prepared by sqlsrv_prepare or sqlsrv_query
- sqlsrv_fetch() - Makes the next row in a result set available for reading
- sqlsrv_get_field() - Gets field data from the currently selected row
Описание на ru2.php.net
Описание на php.ru