problem with odbc_num_rows and odbc_fetch_array in linux. (i use Redhat 9)
odbc_num_rows
on most *nix machines with unixODBC driver it returns -1 in both cases ie. if u find some rows or if u dont find any row. so u cant to use odbc_num_rows to check whether a row exists or not
for eg you can use
if(odbc_num_rows($result) > 0)
{
do something
}
on windows platform.
but for *nix u cant.
so instead use the following function
function better_odbc_num_rows($result)
{
$count=0;
while($temp = odbc_fetch_into($result, &$counter))
{
$count++;
}
return $count;
}
and use
if(better_odbc_num_rows($result) > 0)
{
do something
}
odbc_fetch_array
in *nix
odbc_fetch_array does not exist on some machines. so use
odbc_fetch_into($result, $array);
No comments:
Post a Comment