sql - PHP, Oracle and ODBC: How to check if result set is empty? -


dear nerds , forumianers,

i have delicious problem php on oracle database odbc driver.

first code:

$ora_conn = odbc_connect($ora_dsn, $ora_user, $ora_pass, sql_cur_use_odbc); $ora_data = odbc_exec($ora_conn,$sql);  //echo "test: ".odbc_num_rows( $ora_data ); //exit;  if(odbc_num_rows( $ora_data ) > 0){     // in case no result came }  if($ora_data){     // in case result came } 

if uncomment test, -1! no matter if statement results in 0, 1 or 5 rows...

so code never can information if there no result, 1 result or more results coming back.

do have idea on how solve issue?

thank very in advance help!

best regards, ingmar

odbc_num_rows seems reliable insert, update, , delete queries only.

the manual says:

using odbc_num_rows() determine number of rows available after select return -1 many drivers.

one way around behaviour count(*) in sql instead. see here example.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -