note 87960 modified in function.odbc-num-rows by felipe
| From: | felipe@php.net | Date: | Sat, 17 Jan 2009 01:29:27 +0000 |
| Subject: | note 87960 modified in function.odbc-num-rows by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149357@lists.php.net to get a copy of this message | ||
After minutes of frustration, I realized why odbc_num_rows was not returning the number of affected
rows on a prepared update query. I'm using ODBC to connect to Microsot SQL Server 2005.
My corrected code:
<?php
$query = odbc_prepare($conn, 'UPDATE table SET cat = ? WHERE id = 1');
$result = odbc_execute($query, $category);
$affected = odbc_num_rows($query);
?>
This code works. I was frustrated that odbc_num_rows($result) didn't work as I expected, but
instead required me to pass the original prepared query to this function.
--was--
After minutes of frustration, I realized why odbc_num_rows was not returning the number of affected
rows on a prepared update query. I'm using ODBC to connect to Microsot SQL Server 2005.
My corrected code:
$query = odbc_prepare($conn, 'UPDATE table SET cat = ? WHERE id = 1');
$result = odbc_execute($query, $category);
$affected = odbc_num_rows($query);
This code works. I was frustrated that odbc_num_rows($result) didn't work as I expected, but
instead required me to pass the original prepared query to this function.
http://php.net/manual/en/function.odbc-num-rows.php