PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
PEAR Connection Help

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Database
View previous topic :: View next topic  
Author Message
JSPT2k7



Joined: 18 Dec 2007
Posts: 1

PostPosted: Tue Dec 18, 2007 7:07 am    Post subject: PEAR Connection Help Reply with quote

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
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1053

PostPosted: Tue Dec 18, 2007 12:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Database All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software