getitdone Posted March 1, 2009 Posted March 1, 2009 I am trying to make sure the database is working, cause the program is not. so I have done abit of php but still a newbie (I guess ). In the test.php file I have tried include, require, and just deleting the whole line. All give me errors. ><?php require 'db.php'; $db=DB::connect(my database info); if (DB::isError($db)) {echo ($db->getmessage());} ?> it comes back with this error Warning: require(db.php) [function.require]: failed to open stream: No such file or directory in /home/domain/public_html/test.php on line 2 Warning: require(db.php) [function.require]: failed to open stream: No such file or directory in /home/domain/public_html/test.php on line 2 Fatal error: require() [function.require]: Failed opening required 'db.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/domain/public_html/test.php on line 2 Is the pear DB available to us? Are there any suggestions? Thanks for your time. Quote
TCH-Bruce Posted March 1, 2009 Posted March 1, 2009 You're close. Your require statement needs to know where to look for the include. Try this: >require("/home/your-cpanel-id/public_html/db.php"); This assumes db.php is in your public_html folder. Quote
getitdone Posted March 18, 2009 Author Posted March 18, 2009 You're close. Your require statement needs to know where to look for the include. Try this: >require("/home/your-cpanel-id/public_html/db.php"); This assumes db.php is in your public_html folder. Thanks Quote
carbonize Posted August 16, 2009 Posted August 16, 2009 Small PHP habit to get in to though is to use single quotes as much as possible, like you did in your require statement, as it slightly reduces overheads and increses the speed of the script. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.