RE: [PHP] ODBC Function equivalent to MySql_Fetch_Array
Bob, Why doesn't odbc_fetch_into give you what you want? Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: Bob Horton [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 1:23 AM To: [EMAIL PROTECTED] Subject: [PHP] ODBC Function equivalent to MySql_Fetch_Array Hi, I'm trying to write a function (see below) that will provide equivalent functionality between ODBC and MySQL for mysql_fetch_array based upon a preset variable. I've written something that works but A) I'm afraid it might be quite slow; and B) I'm hoping that there is an existing function to do it that I just didn't see! If there isn't an existing function ... how do I go about requesting it for a future release? One of the key things I was looking for was the field names in the associative array (Note: I already had ... and commented out ... the odbc_fetch_into function ... nice but not quite what I was wanting) Thanks. - function db_fetch_array($result) { global $db_type, $db_connection; if ($db_type == 1) : return mysql_fetch_array($result); else: $i = 0; $fCount = odbc_num_fields($result); $result_array = array(); if (odbc_fetch_row($result)) : while ($i $fCount) $i++; $fName = odbc_field_name($result, $i); $result_array[$fName] = odbc_result($result, $i); } // odbc_fetch_into ($conn, $result_array); return $result_array; else: return false; endif; endif; -- PHP General 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] -- PHP General 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]
RE: [PHP] ODBC Function equivalent to MySql_Fetch_Array
odbc_fetch_into gives me an array but it doesn't give the column names. While many might consider that a small point I find that it helps substantially in making my code self documenting. $row[2] is much less readable than $row[Name] -Original Message- Bob, Why doesn't odbc_fetch_into give you what you want? Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- Hi, I'm trying to write a function (see below) that will provide equivalent functionality between ODBC and MySQL for mysql_fetch_array based upon a preset variable. I've written something that works but A) I'm afraid it might be quite slow; and B) I'm hoping that there is an existing function to do it that I just didn't see! If there isn't an existing function ... how do I go about requesting it for a future release? One of the key things I was looking for was the field names in the associative array (Note: I already had ... and commented out ... the odbc_fetch_into function ... nice but not quite what I was wanting) Thanks. - function db_fetch_array($result) { global $db_type, $db_connection; if ($db_type == 1) : return mysql_fetch_array($result); else: $i = 0; $fCount = odbc_num_fields($result); $result_array = array(); if (odbc_fetch_row($result)) : while ($i $fCount) $i++; $fName = odbc_field_name($result, $i); $result_array[$fName] = odbc_result($result, $i); } // odbc_fetch_into ($result, $result_array); return $result_array; else: return false; endif; endif; -- PHP General 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] -- PHP General 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]
RE: [PHP] ODBC Function equivalent to MySql_Fetch_Array
Bob, Perhaps use odbc_field_name or even odbc_specialcolumns with odbc_fetch_into? I do agree that mysql_fetch_array is quite useful. Dan - what do you think? Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: Bob Horton [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 10:39 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] ODBC Function equivalent to MySql_Fetch_Array odbc_fetch_into gives me an array but it doesn't give the column names. While many might consider that a small point I find that it helps substantially in making my code self documenting. $row[2] is much less readable than $row[Name] -Original Message- Bob, Why doesn't odbc_fetch_into give you what you want? Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- Hi, I'm trying to write a function (see below) that will provide equivalent functionality between ODBC and MySQL for mysql_fetch_array based upon a preset variable. I've written something that works but A) I'm afraid it might be quite slow; and B) I'm hoping that there is an existing function to do it that I just didn't see! If there isn't an existing function ... how do I go about requesting it for a future release? One of the key things I was looking for was the field names in the associative array (Note: I already had ... and commented out ... the odbc_fetch_into function ... nice but not quite what I was wanting) Thanks. - function db_fetch_array($result) { global $db_type, $db_connection; if ($db_type == 1) : return mysql_fetch_array($result); else: $i = 0; $fCount = odbc_num_fields($result); $result_array = array(); if (odbc_fetch_row($result)) : while ($i $fCount) $i++; $fName = odbc_field_name($result, $i); $result_array[$fName] = odbc_result($result, $i); } // odbc_fetch_into ($result, $result_array); return $result_array; else: return false; endif; endif; -- PHP General 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] -- PHP General 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] -- PHP General 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]
RE: [PHP] ODBC Function equivalent to MySql_Fetch_Array
Bob, Perhaps use odbc_field_name or even odbc_specialcolumns with odbc_fetch_into? I do agree that mysql_fetch_array is quite useful. Dan - what do you think? Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: Bob Horton [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 10:39 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] ODBC Function equivalent to MySql_Fetch_Array odbc_fetch_into gives me an array but it doesn't give the column names. While many might consider that a small point I find that it helps substantially in making my code self documenting. $row[2] is much less readable than $row[Name] -Original Message- Bob, Why doesn't odbc_fetch_into give you what you want? Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- Hi, I'm trying to write a function (see below) that will provide equivalent functionality between ODBC and MySQL for mysql_fetch_array based upon a preset variable. I've written something that works but A) I'm afraid it might be quite slow; and B) I'm hoping that there is an existing function to do it that I just didn't see! If there isn't an existing function ... how do I go about requesting it for a future release? One of the key things I was looking for was the field names in the associative array (Note: I already had ... and commented out ... the odbc_fetch_into function ... nice but not quite what I was wanting) Thanks. - function db_fetch_array($result) { global $db_type, $db_connection; if ($db_type == 1) : return mysql_fetch_array($result); else: $i = 0; $fCount = odbc_num_fields($result); $result_array = array(); if (odbc_fetch_row($result)) : while ($i $fCount) $i++; $fName = odbc_field_name($result, $i); $result_array[$fName] = odbc_result($result, $i); } // odbc_fetch_into ($result, $result_array); return $result_array; else: return false; endif; endif; -- PHP General 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] -- PHP General 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] -- PHP General 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]
RE: [PHP] ODBC Function equivalent to MySql_Fetch_Array
Well, if you noticed the function I wrote and included as part of my original post ... it already uses odbc_field_name but I'm not sure how I would use it in connection with odbc_fetch_into. My 2 key questions were: 1) Is there some function that I missed that does the equivalent of mysql_fetch_array? and 2) Is there any way to get the function I wrote to be more efficient? Bob, Perhaps use odbc_field_name or even odbc_specialcolumns with odbc_fetch_into? I do agree that mysql_fetch_array is quite useful. Dan - what do you think? Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: Bob Horton [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 10:39 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] ODBC Function equivalent to MySql_Fetch_Array odbc_fetch_into gives me an array but it doesn't give the column names. While many might consider that a small point I find that it helps substantially in making my code self documenting. $row[2] is much less readable than $row[Name] -Original Message- Bob, Why doesn't odbc_fetch_into give you what you want? Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- Hi, I'm trying to write a function (see below) that will provide equivalent functionality between ODBC and MySQL for mysql_fetch_array based upon a preset variable. I've written something that works but A) I'm afraid it might be quite slow; and B) I'm hoping that there is an existing function to do it that I just didn't see! If there isn't an existing function ... how do I go about requesting it for a future release? One of the key things I was looking for was the field names in the associative array (Note: I already had ... and commented out ... the odbc_fetch_into function ... nice but not quite what I was wanting) Thanks. - function db_fetch_array($result) { global $db_type, $db_connection; if ($db_type == 1) : return mysql_fetch_array($result); else: $i = 0; $fCount = odbc_num_fields($result); $result_array = array(); if (odbc_fetch_row($result)) : while ($i $fCount) $i++; $fName = odbc_field_name($result, $i); $result_array[$fName] = odbc_result($result, $i); } // odbc_fetch_into ($result, $result_array); return $result_array; else: return false; endif; endif; -- PHP General 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] -- PHP General 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] -- PHP General 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]