downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

mssql_select_db> <mssql_result
[edit] Last updated: Fri, 18 May 2012

view this page in

mssql_rows_affected

(PHP 4 >= 4.0.4, PHP 5, PECL odbtp >= 1.1.1)

mssql_rows_affectedLiefert die Anzahl der von einer Anfrage betroffenen Datensätze

Beschreibung

int mssql_rows_affected ( resource $link_identifier )

Gibt die Anzahl der von einer Anfrage betroffenen Datensätze zurück.

Parameter-Liste

link_identifier

Der von mssql_connect() oder mssql_pconnect() zurückgegebene Bezeichner einer MS SQL-Verbindung

Rückgabewerte

Gibt die Anzahl der Datensätze zurück, die von der letzten Operation betroffen waren.

Beispiele

Beispiel #1 mssql_rows_affected()-Beispiel

<?php
// Alle Zeilen einer Tabelle löschen
mssql_query('TRUNCATE TABLE [php].[dbo].[persons]');

echo 
mssql_rows_affected($verbindung) . ' Zeile(n) gelöscht';
?>



add a note add a note User Contributed Notes mssql_rows_affected
rowan dot collins at gmail dot com 31-May-2007 10:42
Note that, as the page says, this function expects an MSSQL *Link* resource, not a *result* resource. This is a bit counter-intuitive, and differs from, for instance, pg_affected_rows (though not, apparently, mysql_affected_rows).

<?php
$link
= mssql_pconnect($db_host,$db_user,$db_pass);
mssql_select_db($db_name, $link);

$result = mssql_query('Select 1', $link);

$rows = mssql_rows_affected($result); # ERROR!
$rows = mssql_rows_affected($link); # Correct
?>

 
show source | credits | sitemap | contact | advertising | mirror sites