Abscissa Tech Home Design Coding Media Server
Tutorials Courses Forums Resources
  Home
 
  Member Options
    Sign Up
  Log In
 
  Tools
    PowerHTML
    Teacher's Lounge
  References
  HTML
  PHP
  CSS
 
  Search
 
 
    Legalese
    Contact Us
    Privacy Policy
    About Abscissa

odbc_connect

odbc_connect -- Connect to a datasource

Description

int odbc_connect(string dsn, string user, string password, int [cursor_type]);

Returns an ODBC connection id or 0 (false) on error.

The connection id returned by this functions is needed by other ODBC functions. You can have multiple connections open at once. The optional fourth parameter sets the type of cursor to be used for this connection. This parameter is not normally needed, but can be useful for working around problems with some ODBC drivers.

With some ODBC drivers, executing a complex stored procedure may fail with an error similar to: "Cannot open a cursor on a stored procedure that has anything other than a single select statement in it". Using SQL_CUR_USE_ODBC may avoid that error. Also, some drivers don't support the optional row_number parameter in odbc_fetch_row(). SQL_CUR_USE_ODBC might help in that case, too.

The following constants are defined for cursortype:

  • SQL_CUR_USE_IF_NEEDED

  • SQL_CUR_USE_ODBC

  • SQL_CUR_USE_DRIVER

  • SQL_CUR_DEFAULT

For persistent connections see odbc_pconnect().

This PHP manual is Copyright © 1997, 1998, 1999, 2000 the PHP Documentation Group. It has been licensed under the GPL. Permission granted for display on the Abscissa Tech web site on March 9, 2000. The most recent PHP documentation is available at http://www.php.net/.