note 50364 added to function.odbc-data-source
| From: | critmas at hotmail dot com | Date: | Fri, 25 Feb 2005 19:53:11 +0000 |
| Subject: | note 50364 added to function.odbc-data-source | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-85540@lists.php.net to get a copy of this message | ||
Thank you Angelo for point out the code. Though the function doesn't really do what it is
supposed to. It returns the entire list of ODBC DSNs.
If you really are looking to get the server type based on just the ODBC, username and password in an
environment where the application needs to be aware of different types of databases, use the
following code:
$link2 = odbc_connect($dsn , $DBUser, $DBPwd ) or die(odbc_errormsg() );
$result = @odbc_data_source( $link2, SQL_FETCH_FIRST );
while($result)
{
if (strtolower($dsn) == strtolower($result['server'])) {
echo $result['description'] . "<br>\n";
break;
}
else
$result = @odbc_data_source( $link2, SQL_FETCH_NEXT );
}
odbc_close($link2);
// Hope it saves your precious time
----
Manual Page -- http://www.php.net/manual/en/function.odbc-data-source.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50364
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50364&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50364&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50364&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50364&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50364&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50364&report=yes
Search -- http://master.php.net/manage/user-notes.php