Re: [PHP-DB] odbc_fetch_row
Randall, Try something like: if (!(odbc_result($result_identifier)) echo "result is null"; Best regards, Andrew Andrew Hill . Director Technology Evangelism OpenLink Software . http://www.openlinksw.com Internet Data Integration Technology On 4/13/01 6:30 PM, "Randall Barber" [EMAIL PROTECTED] wrote: When I run a query, even if it is empty I still get a valid identifier for the result. How do I determine that there is nothing in the result, even though the result is valid (just empty)? I thought about odbc_fetch_row, but that moves the pointer forward and I don't want that; there may be valid info. I tried odbc_result'ing a COLUMN and it returns NULL not error, so I can't test against that. One thought is to see if all columns in my query are NULL and then "No rows were found". Is there a simpler way? How does odbc_result_all determine there is nothing present? Thanks RDB -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] odbc_fetch_row
maybe you could try odbc_num_rows($yourResultID) this will return 0 if there is nothing in the result set or the number of rows otherwise look in the php manual for more info http://www.php.net/manual/en/function.odbc-num-rows.php note that it might return -1 (thus not work as intended) with some drivers, look in the user contributed notes at the bottom of the manual page, there seems to be a few solution to that -1 problem Francois Legare [EMAIL PROTECTED] Vancouver BC Canada 604.261.1320 -Original Message- From: Randall Barber [mailto:[EMAIL PROTECTED]] Sent: April 13, 2001 3:30 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] odbc_fetch_row When I run a query, even if it is empty I still get a valid identifier for the result. How do I determine that there is nothing in the result, even though the result is valid (just empty)? I thought about odbc_fetch_row, but that moves the pointer forward and I don't want that; there may be valid info. I tried odbc_result'ing a COLUMN and it returns NULL not error, so I can't test against that. One thought is to see if all columns in my query are NULL and then "No rows were found". Is there a simpler way? How does odbc_result_all determine there is nothing present? Thanks RDB -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]