Jump to content


Photo

PEAR DB.php location


  • Please log in to reply
2 replies to this topic

#1 funkgut

funkgut
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 26 August 2006 - 03:14 PM

Hello all,

I am a pear newbie.  I am having my site hosted on a virtual server with plesk and my host host says they have PEAR support.

My problem is where to find DB.php that is included in all the files.  This has all the db variables so none of pages work. Is there a place that PEAR is usually nstalled on a host or what?

Thanks,

#2 funkgut

funkgut
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 26 August 2006 - 05:13 PM

when I go to this page nothing shows up I get no errors, just a blank page

<?php

require 'db_connect.php';

// require above script
// change the path to match wherever you put it.


$table = "CREATE TABLE users (
id int(10) DEFAULT '0' NOT NULL auto_increment, 
username varchar(40),
password varchar(50), 
fullname varchar(65),
address varchar(150),
city varchar(50),
state varchar(4),
zip varchar(15),
email varchar(100),
chiefemail(100)
location varchar(150),
show_email int(2) DEFAULT '0',
last_login varchar(20),
PRIMARY KEY(id))";

$create = $db_object->query($table);	//perform query

if(DB::isError($create)) {
	die($create->getMessage());
} else {
	echo 'Table created successfully.';

}

$db_object->disconnect();

?>


#3 funkgut

funkgut
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 26 August 2006 - 05:14 PM

here is db_connect.php


<?php

//require the PEAR::DB classes.

require_once '/usr/bin/pear/DB.php';


$db_engine = 'mysql';
$db_user = 'ply_mess';
$db_pass = 'bill1022';
$db_host = 'localhost';
$db_name = 'plymovent';

$datasource = $db_engine.'://'.
			  $db_user.':'.
			  $db_pass.'@'.
		 	  $db_host.'/'.
	  		  $db_name;


$db_object = DB::connect($datasource, TRUE);

/* assign database object in $db_object, 

if the connection fails $db_object will contain

the error message. */

// If $db_object contains an error:

// error and exit.

if(DB::isError($db_object)) {
	die($db_object->getMessage());
}

$db_object->setFetchMode(DB_FETCHMODE_ASSOC);

// we write this later on, ignore for now.
include('check_login.php');


?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users