You are here: Re: PEAR MDB2 - Fatal error: Call to undefined function MDB2_Driver_mssql::getMessage() « PHP Programming Language « IT news, forums, messages
Re: PEAR MDB2 - Fatal error: Call to undefined function MDB2_Driver_mssql::getMessage()

Posted by Erwin Moller on 02/20/07 10:01

salvadorvp@gmail.com wrote:

> Hi, I have the following code that gives me this odd error message at
> a line of code inside the PEAR libraries:
>
> "Fatal error: Call to undefined function:
> MDB2_Driver_mssql::getMessage(). in C:\php\PEAR\lib\MDB2.php on line
> 1921"
>
> My code is a simple submit processing form for a login page:
>
> <?php
> require_once('Database/MSSQL_Constants_TEST.php');
> require_once('MDB2.php');
>
> $dsn = array(
> 'phptype' => "mssql",
> 'hostspec' => $MY_DB_HOST,
> 'port' => $MY_DB_PORT,
> 'database' => $MY_DB_NAME,
> 'username' => $MY_DB_USER,
> 'password' => $MY_DB_PASS
> );
> $dbh = MDB2::connect($dsn);

Hi,

Shouldn't that be with a &?

$dbh =& MDB2::connect($dsn);

http://pear.php.net/package/MDB2/docs/2.3.0/MDB2/MDB2.html#methodconnect

Regards,
Erwin Moller

>
> if (PEAR::isError($dbh)) {
> echo "An error occurred while trying to connect to the database
> server.<br>\n";
> echo "Error message: " . $dbh->getMessage() . "<br>\n";
> echo "A more detailed error description: " . $dbh-
>>getDebugInfo() . "<br>\n";
> exit();
> }
>
> // Check username and password
> $result = false;
> if ( isset($_POST['username']) && isset($_POST['password']) ) {
> $params = array($_POST['username'], $_POST['password']);
> $result = $dbh->query($WEBAPP_LOGIN_SQL, $params);
>
> if (PEAR::isError($result)) {
> echo "An error occurred while trying execute the following
> query:<br>\n";
> echo "$WEBAPP_LOGIN_SQL<br>\n";
> echo "Error message: " . $dbh->getMessage() . "<br>\n";
> echo "A more detailed error description: " . $dbh-
>>getDebugInfo() . "<br>\n";
> exit();
> }
> }
>
> // Forward to the resulting page
> if (!$result) {
> header( "Location: login.php?bad=1" );
> } else {
> header( "Location: portal.php" );
> }
>
> ?>
>
> I will apreciate the help!!!!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация