I loop through an ODBC datasource and deal with each field in turn. If the field type is MEMO then PHP returns an error. Is there a way to detect the field type and skip the field and then avoid the error?
Error:
Warning: odbc_result(): SQL error: [Microsoft][ODBC Driver Manager] Invalid cursor state, SQL state 24000 in SQLGetData in E:\NewIntranet\scripts\files.inc.php on line
Code:
Error:
Warning: odbc_result(): SQL error: [Microsoft][ODBC Driver Manager] Invalid cursor state, SQL state 24000 in SQLGetData in E:\NewIntranet\scripts\files.inc.php on line
Code:
Code:
$query = "SELECT * FROM qryclientsData WHERE ClientKey like '" . $_POST['custname'] . "' ORDER BY ClientKey ;";
if(!($odbc_db = odbc_connect($odbc_dsn, $odbc_userid, $odbc_password)))
die ("Could not connect ot ODBC data source $odbc_dsn");
if(!($odbc_rs = odbc_do($odbc_db, $query)))
die("Error executing query $query");
$num_cols = odbc_num_fields($odbc_rs);
if($num_cols < 1) die("Query returned an empty set");
for( $i = 0; $i <= $num; $i++ )
{
odbc_fetch_row( $odbc_rs );
//use column headings
for($a=1;$a<=$num_cols;$a++)
{
// echo odbc_field_name($odbc_rs, $a);
$fieldname = odbc_field_name($odbc_rs, $a);
$wordfieldname = '[' . $fieldname . ']';
$results = odbc_result( $odbc_rs, $fieldname);