Re: [PHP-PEAR] oci8 error in DB.php
[email protected] ("Mark")
| Newsgroups | php.pear |
|---|---|
| Message-ID | <[email protected]> |
Let me take that back now, I seem to be able to play with the connect string and get rid of the undefined query function message, could this mean I am actually connecting, if so why still the "unknown error". At this moment I am getting both errors. DB Error: unknown error Fatal error: Call to undefined function: query() in functions.php on line 74 I assume this to mean I am not connecting, any ideas suggestions would be greatly appreciated. I'm fairly sure the problem is in the connect string but if anyone could help me decipher the code enough to understand what causes a "unknown error" or how to get a more verbose error message please let me know, it seems to be just a generic error. oci8.php says: // // be aware... OCIError() only appears to return anything when given a // statement, so functions return the generic DB_ERROR instead of more // useful errors that have to do with feedback from the database. // I really need this to work it's, the arguably the most important part of this application. I've put in far too much time with pear to switch now, besides I want this app to have some staying power and looks like pear will be with us a while. -Mark ""Mark"" <[email protected]> wrote in message news:[email protected]... > Ok, thanks for your help, The undefined function message is gone, now I get: > > DB Error: unknown error > > the same message I got when I tried a similar thing earlier. It's not very > verbose in its error handling, could mean anything? > > -Mark > > quite strange if you ask me. At leasti > "Stig Sæther Bakken" <[email protected]> wrote in message > news:[email protected]... > > ["Mark" <[email protected]>] > > > I'm getting an error too, though it is different, > > > > > > Here it is: > > > > > > Fatal error: Call to undefined function: query() in functions.php on > line 70 > > > > > > Here is the code that causes the error, what is wrong? > > > > > > function funcLogin($username, $password) > > > { > > > include './dbinfo.php'; > > > require_once( 'DB.php' ); > > > > > > if(!$username || !$password) > > > { > > > $feedback .= 'User Name and Password are both required'; > > > return false; > > > }else{ > > > $db = DB::connect( "oci8://$dbuser:$dbpass@$dbhost/$dbname"); > > > > > > $sql = "SELECT * FROM rusers where username = '$username' AND > > > password='". md5($password) ."'; > > > > > > if ( DB::isError( $doesUserExist = $db->query( $sql ) ) ) > > > { > > > echo DB::errorMessage($doesUserExist); > > > }else{ > > > // output results of query into $resultRow Array > > > // other code not related to problem at hand........ > > > > You are not checking whether DB::connect() actually succeeds. If it > > doesn't, you'll get an error object back, and error objects have no > > "query" method. Add this after the DB::connect line: > > > > if (DB::isError($db)) { > > print $db->getMessage()."<BR>\n"; > > return; // (or whatever) > > } > > > > - Stig > > > > -- > > PHP Extension and Add-on Repository (PEAR) mailing list. > > Documentation can be found at http://pear.php.net/doc/pear.html > > To unsubscribe, e-mail: [email protected] from the > > mail address you subscribed with. > > > > > > -- > PHP Extension and Add-on Repository (PEAR) mailing list. > Documentation can be found at http://pear.php.net/doc/pear.html > To unsubscribe, e-mail: [email protected] from the > mail address you subscribed with. >