 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
JSPT2k7
Joined: 18 Dec 2007 Posts: 1
|
Posted: Tue Dec 18, 2007 7:07 am Post subject: PEAR Connection Help |
|
|
Hello, I'm new to PEAR and was wondering why does my script always return my login information and not execute any other lines after the require_once 'DB.php';
Example if I do
<?php
echo ("good");
include ('db_login.php');
require_once ('DB.php');
?>
I would get
goodlocalhostrootpassworddata_collectionResource id #3
my whole script currently is like this
<?php
include ('db_login.php');
require_once('DB.php');
$connection = DB::conect("mysql://$db_username:$db_password@$db_host/$db_database");
if (DB::isError($connection))
{
die ("could not connect to the database: <br />" . DB::errorMessage($connection));
}
$query = "select * from data";
echo $query;
$result = $connection->query($query);
if (DB::isError($result))
{
die ("could not query the database: <br />" . DB::errorMessage($result));
}
while ($result_row = $result->fetchRow())
{
echo $result_row[1];
}
$connection->disconnect();
?>
my output from the above is
localhostrootpassworddata_collectionResource id #4
I installed pear using go-pear.bat, doubled clicked on the PEAR_env.reg file, installed DB package with Pear install DB, doing a pear list shows that DB is installed, edited php.ini for the pear include path, restarted computer. Any help would be great
Thanks |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Tue Dec 18, 2007 12:08 pm Post subject: |
|
|
Do you really have the following line in your script?
| Code: |
$connection = DB::conect("mysql://$db_username:$db_password@$db_host/$db_database");
|
(note the typo: "conect" => "connect")
If you haven't noted this, you have error reporting turned off. Please add the following lines at the beginning of your script:
| Code: |
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once 'PEAR.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
|
About the output of the password: What are you doing in db_login.php? Do you define only the $db_* variables there or is there anything else that could generate the output? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|