| View previous topic :: View next topic |
| Author |
Message |
freethinker33
Joined: 06 Jun 2008 Posts: 3 Location: California / Iowa
|
Posted: Fri Jun 06, 2008 4:50 am Post subject: MDB2_Driver_mysql Problems |
|
|
Hey everyone, thanks in advance for any help. Really excited to get Pear going and thought I was making good headway until this!
Problem: I already ran "pear install MDB2_Driver_mysql-beta" and I get this:
MDB2 Error: not found :: unable to find package 'MDB2_Driver_mysql' file 'MDB2/Driver/mysql.php'
Fatal error: Call to undefined method MDB2_Error::query() in /Library/WebServer/Documents/sc/dblib.php on line 15
Below is dblib.php
| Code: |
<?php
require_once( "MDB2.php" );
$dsn = 'mysql://root:some-password@localhost/sc';
$mdb2 =& MDB2::factory( $dsn, array() );
if (PEAR::isError($mdb2)) {
echo $mdb2->getMessage(). ' :: '. $mdb2->getUserInfo();
}
function get_db() { global $mdb2; return $mdb2; }
function get_products( )
{
global $mdb2;
$res = $mdb2->query( "SELECT * FROM product", array( ) );
$out = array();
if ( $res != null )
while( $res->fetchInto( $row, MDB2_FETCHMODE_ASSOC ) ) { $out []= $row; }
return $out;
}
function product_info( $id )
{
global $mdb2;
$res = $mdb2->query( "SELECT * FROM product WHERE id=?",
array( $id ) );
if ( $res != null )
{
$res->fetchInto( $row, MDB2_FETCHMODE_ASSOC );
return $row;
}
return null;
}
?>
|
I think it's just telling me one of my configs is wrong - it can't find it so I must have pointed something wrong. When I run tests Pear runs correctly. However when I look at all my configs it states that php.ini is undefined... is that the problem and if so how can I fix that? |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Fri Jun 06, 2008 1:58 pm Post subject: |
|
|
| Did you update your include_path? It needs to include the directory in which PEAR.php (and MDB2.php) reside. |
|
| Back to top |
|
 |
freethinker33
Joined: 06 Jun 2008 Posts: 3 Location: California / Iowa
|
Posted: Fri Jun 06, 2008 9:59 pm Post subject: Yes |
|
|
Hey Mark, thanks for your response. Yes I did change the path to my includes correctly in both my php.ini and php.ini.default (even though I know I only needed to do the first, I'm just being double sure)
I can run several tests to get PEAR to echo things and validate that it is in fact alive and well -- only trouble here is that it's unable to find my package: unable to find package 'MDB2_Driver_mysql' file 'MDB2/Driver/mysql.php'
Know how I can get it to find those files? :-S
Thank you!  |
|
| Back to top |
|
 |
freethinker33
Joined: 06 Jun 2008 Posts: 3 Location: California / Iowa
|
Posted: Fri Jun 06, 2008 11:32 pm Post subject: One more thing |
|
|
I can install a wordpress, or any database and write old school queries and get results.
This is making me think there just may be something wrong in my code.
Time to make another pot of coffee
 |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Sat Jun 07, 2008 12:02 pm Post subject: |
|
|
Ah, the file is actually missing? You didn't read the installation instructions then.
pear install MDB2_Driver_mysql
or
pear install MDB2#mysql |
|
| Back to top |
|
 |
|