note 24823 rejected from function.odbc-exec by spic

From: Date: Thu, 29 Aug 2002 12:32:29 +0000
Subject: note 24823 rejected from function.odbc-exec by spic
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-35976@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

« previous php.notes (#35976) next »