I am using the odbc support in PHP 5.2 to connect to a sqlserver 2005 database. The odbc driver being used is the SQLSRV32.dll provided as part of the install.
In the code below I find that if I use SQL_CUR_USE_ODBC as an option to odbc_connect, the odbc_fetch_row() call below fails even though the odbc_exec was successful. However, if I remove the SQL_CUR_USE_ODBC option the code executes successfully. I have another query that uses some left outer joins on two tables and am only able to read the results with odbc_fetch_row only if SQL_CUR_USE_ODBC is used in odbc_conect. How does one decide which cursor option to use? Thanks Abhay $connect = odbc_connect("DB", "xx", "xxxx", SQL_CUR_USE_ODBC); if (!$connect) { print("Connect failed."); exit(); } $query="SELECT TOP 1 Version FROM Versions ORDER BY VersionIndex DESC"; $result = odbc_exec($connect, $query); if (!$result) { print(" Failed to execute $query."); exit(); } //odbc_fetch_row below is successful if no cursor or SQL_CURSOR_FORWARD_ONLY //is specified in the odbc_connect call. Why does //SQL_CUR_USE_ODBC fail? if (odbc_fetch_row($result)) { $data = odbc_result($result, 1); print("GOT data $data."); } var callCount = 0; function rmvScroll( msg ) { if ( ++callCount > 10 ) { msg.style.visibility = "visible"; } if ( callCount msg.clientHeight ) { newHeight = msg.scrollHeight + delta; } delta = msg.offsetWidth - msg.clientWidth; delta = ( isNaN( delta )? 1 : delta + 1 ); if ( msg.scrollWidth > msg.clientWidth ) { newWidth = msg.scrollWidth + delta; } msg.style.overflow = "visible"; msg.style.visibility = "visible"; if ( newWidth > 0 || newHeight > 0 ) { var ssxyzzy = document.getElementById( "ssxyzzy" ); var cssAttribs = ['#' + msg.id + '{']; if ( newWidth > 0 ) cssAttribs.push( 'width:' + newWidth + 'px;' ); if ( newHeight > 0 ) cssAttribs.push( ' height:' + newHeight + 'px;' ); cssAttribs.push( '}' ); try { ssxyzzy.sheet.deleteRule( 0 ); ssxyzzy.sheet.insertRule( cssAttribs.join(""), 0 ); } catch( e ){} } } function imgsDone( msg ) // for Firefox, we need to scan for images that haven't set their width yet { var imgList = msg.getElementsByTagName( "IMG" ); var len = ((imgList == null)? 0 : imgList.length); for ( var i = 0; i [input] [input] [input] [input] [input] [input] [input] [input] Delete Reply --------------------------------- Never miss a thing. Make Yahoo your homepage.