Jump to content

Archived

This topic is now archived and is closed to further replies.

funkgut

PEAR DB.php location

Recommended Posts

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,

Share this post


Link to post
Share on other sites
when I go to this page nothing shows up I get no errors, just a blank page

[code]<?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();

?>[/code]

Share this post


Link to post
Share on other sites
here is db_connect.php


[code]<?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');


?>[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.