
March 29th, 2007, 06:02 PM
|
|
|
|
Join Date: Apr 2007
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
ODBC "DB Error: not supported"
I'm trying to move a web application from the development environment (Linux/Apache/MySQL) to the production environment (Windows2000/IIS/ODBC[SqlServer]) and I'm encountering the following error when I try a query:
"DB Error: not supported"
I'm using PEAR:  B and PHP 4.3.3
We just installed the PEAR libraries using go_pear.bat and it seemed to install just fine.
Here is the code... it is a login script that
either authenticates the user or sends them back
to the index.php page to try again:
php Code:
Original
- php Code |
|
|
|
<?php require_once( "DB.php" ); require_once( "dconfig.php" ) ; $db =& DB::Connect( $dsn ) ; // , array() ); print "<html><head>testpage</head><body><pre>n" ; if (PEAR::isError($db)) { // header("Location: index.php?e=01") ; $str = "Location: index.php?e=01&" . $db->getMessage() ; } else { $db->setFetchMode(DB_FETCHMODE_ASSOC) ; if ( isset($_POST['useremail']) and isset($_POST['userpass']) ) { $SQL = " SELECT id, isadmin FROM users WHERE email = ? and password_string = ? " ; $STMT = $db->prepare( $SQL ) ; $res =& $db-> execute( $STMT, array($_POST['useremail'], $_POST['userpass']) ) ; if (PEAR::isError($res)) { // query failed header("Location: index.php?e=02") ; }else{ if ( $res->numRows() == 1 ) { if ( $res->fetchinto($row) ) { $_SESSION['userid'] = $row['id'] ; $_SESSION['isadmin'] = $row['isadmin'] ; // Authenticated user.... proceed header("Location: welcome.php") ; }else{ // unable to process the row of data (?!) header("Location: index.php?e=03") ; } }elseif ( $res->numRows() > 1 ) { // multiple records - needs admin to fix // header("Location: index.php?e=04" ) ; }else{ // no record - bad login header("Location: index.php?e=00") ; } } }else{ // attempt to directly execute login.php (missing POST vars) header("Location: index.php") ; } } print "</pre></body></html>" ; ?>
|