From:             [EMAIL PROTECTED]
Operating system: SCO Openserver 5.0.5 & RH Lnux 7
PHP version:      4.0.6
PHP Bug Type:     ODBC related
Bug description:  odbc_fetch_into different issue

Platforms:
Using PHP 4.0.6/Openlink 4.1/Progress 8.3D.

Other:
I've tried PHP 4.0.4/4.0.5/4.0.6, Openlink 3.2,4.0,4.1, Progress
8.3C,8.3D,9.1C, shared memory and TCP/IP based connections.

Problem:
Doesn't seem to matter what I do, I am completely unable to select specific
rows using ODBC.
I think the code below is correct, it's snipped from scripts.

<?
$dsn="DSN=$database;UID=$user;PWD=$password";

// I've tried all these without a difference.
$cursor="SQL_CUR_USE_ODBC";
//$cursor="SQL_CUR_IF_NEEDED";
//$cursor="SQL_CUR_USE_DRIVER";
//$cursor="SQL_CUR_DEFAULT";
$sql="SELECT * FROM user_table";
$text="";

function db_fetch_into($id, $number) {
global $text;
$text = "<TD>ROW: $number</TD>";
  //Never Returns Anything
  //odbc_fetch_into($id, $number, $result_array);
  //Always Works
  odbc_fetch_into($id, $result_array);
  //Always Works
  //odbc_fetch_into($id, 0, $result_array);
  return $result_array;
}

if ($conn=odbc_connect("$dsn","","","$cursor")){
  echo "<TABLE border='1'>";
  //while ((odbc_fetch_into($results,$pos,$row)) && ($count<$limit)) {
  $pos=0;
  while ((list($var1,$var2) = db_fetch_into($result, $pos)) && ($pos<10))
{
    echo "<TR>$text<TD>$var1</TD><TD>$var2</TD></TR>";
    $pos ++;
  }
  echo "</TABLE>";
  odbc_free_result($result);
  odbc_close($conn);
} else {
  // No connection .....
}

?>
-- 
Edit bug report at: http://bugs.php.net/?id=13783&edit=1


-- 
PHP Development 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]

Reply via email to