Jump to content

Calendar Database Error


jrapin

Recommended Posts

When I use my admin.php page to link to my calendar database, it tells me:
Fatal error: Failed opening required 'DB.php' (include_path='/php\pear') in /home/webadmin/kewadin.com/html/calendar/cal_inc.php on line 4

The beginning of the code requires the "DM.php" file. It doesn't open and gives the former error message.

Here's the PHP code on the Calendar Admin Page in Question:
<?php
function connect() {
ini_set("include_path", "C:\php\pear");
require_once("DB.php");
$type = "mysql";
$username = "caladmin";
$password = "caladmin";
$host = "localhost";
$database = "event_calendar";
$dsn = $type . "://" . $username . ":" . $password . "@" . $host . "/" . $database;
$dbconn = DB::connect($dsn);
errortrap($dbconn);
$dbconn->setFetchMode(DB_FETCHMODE_ASSOC);
return $dbconn;
}//end connect

Obviously, the error is in line 4 because it can't open the DB file. I believe this is because the path is set to ("include_path", "C:\php\pear"); when in fact the DB.php file is located on the MySQL database. How do I fix this error. What is the correct path for the "php.pear"? Since the file is not on my computer but rather on the FTP site how do I reference this fact so that the pear can be found correctly?

Respectfully,

MySQL & PHP Student
Link to comment
Share on other sites

[quote author=jrapin link=topic=113598.msg461679#msg461679 date=1162476314]
Obviously, the error is in line 4 and the PHP can't open the DB file. I believe this is because the path is set to ("include_path", "C:\php\pear"); when in fact the DB.php file is located not on the C Drive, but stored ob the MySQL database. How do I fix this error. Please help.
[/quote]

I've quoted the portion of your post that makes no sense to me whatsoever. What do you mean, [i]the file is stored in the MySQL database[/i]? Is it stored as a BLOB in the database itself? If so, you can't use an include() statement on the file, but rather, you'll have to make a connection to the MySQL database and pull the file out that way. The problem is, it seems like you are attempting to include your database connection, so you'd be running in circles.

Yes, it appears that the include_path you are specifying is what's throwing you off, but without knowing a little more about your structure, it's going to be hard to help you fix it.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.