note 24823 added to function.odbc-exec
| From: | zorn dot exm at gmx dot de | Date: | Thu, 29 Aug 2002 12:26:55 +0000 |
| Subject: | note 24823 added to function.odbc-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-35974@lists.php.net to get a copy of this message | ||
Hi PHP-Community...
i have a problem with the odbc_exec function under linux ... i use unixodbc and the freetds driver
with php 4.2.1 ...
here is the code snip that doesnt work:
function num_row_sql($sql_string)
{
$anzahl = 0;
$connection = odbc_connect('Lison', 'sa', 'supplynet1');
$x = odbc_exec($connection, $sql_string);
while (odbc_fetch_row($x))
{
$anzahl++;
}
return $anzahl;
}
$result = odbc_exe ($connection,$query);
echo num_row_sql($query)."<br>";
this code produces the follwing error:
Warning: SQL error: , SQL state 00000 in SQLExecDirect in /usr/local/apache/htdocs/test-odbc.php on
line 26
Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in
/usr/local/apache/htdocs/test-odbc.php on line 28
... but if change the order of the calls to:
echo num_row_sql($query)."<br>";
$result = odbc_exec($connection, $query);
everythings runs fine.. whats wrong with the order.. i hope anyone can help me out...
thanks and best regards...
Rouven
--
http://www.php.net/manual/en/function.odbc-exec.php
http://master.php.net/manage/user-notes.php?action=edit+24823
http://master.php.net/manage/user-notes.php?action=delete+24823
http://master.php.net/manage/user-notes.php?action=reject+24823