473,395 Members | 1,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

require_once DB.php Help.

2
Good day, My OS is Windows Vista, Apache2.2, MySQL5 and PHP5 and PEAR.
I have Oreilly's PHP and MySQL second edition examples in my cgi-bin
which is my server root. All of the examples run without error
except Example.7-1. below or any script that starts with
require_once "DB.php" which throws the error DB not found.
The curious thing is if I open the same file from the wda. folder
in my cgi-bin into Dreamweaver it works fine but not from the
copied file in my cgi-bin.eg."http://localhost example.7-1.php.
Any help would be much appreciated.
Thank's richard@comrefhvac.com
<?php
require_once "DB.php";
require "db.inc";

$dsn = "mysql://{$username}:{$password}@{$hostName}/{$databaseName}";

// Open a connection to the DBMS
$connection = DB::connect($dsn);

if (DB::isError($connection))
die($connection->getMessage());

// (Run the query on the library through the connection
$result = $connection->query("SELECT * FROM wine");

if (DB::isError($result))
die ($result->getMessage());

// While there are still rows in the result set, fetch the current
// row into the array $row
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
// Print out each element in $row, that is, print the values of
// the attributes
foreach ($row as $attribute)
print "{$attribute}";

print "\n";
}
?>
Mar 13 '07 #1
1 2654
ronverdonk
4,258 Expert 4TB
You have been asked before in your thread http://www.thescripts.com/forum/thread604558.html and you obviously want to ignore the request.

Read the Posting Guidelines before you post in this forum!

Especially the part about enclosing code within [php] or [code] tags!!


moderator
Mar 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: the wonderer | last post by:
This is an elementary question, but I've not been able to find the answer, so here goes: I am developing a site using php. I have the html header information in a file that I include in all the...
0
by: NotGiven | last post by:
Below is a code snippet I am having a hard time with. I rerquire code1.php and code 2.php. code1.php contains some variables the code needs. code2.php contains some functions I call from the...
6
by: Nik Coughin | last post by:
Say I have a script: http://www.mydomain.com/test/admin/foo.php That looks like this: <?php $baseDir = "http://" . $_SERVER . "/test"; require_once( $baseDir . '/helpers/helper.php' );
5
by: mostof | last post by:
I'm facing a problem with require_once... Instead of actually including the file i'm requiring, it just dumps it out as text... other functions are working quite well... the code look like...
3
by: Sean Quinn | last post by:
Hi, I don't know if anyone has run into similar problems, but it seems like when I use `require_once(...)' with files that contain functions I get an error indicating that it can't redeclare the...
11
by: Kimmo Laine | last post by:
I'm flipping my wig here, people. I'm using classes and making each class a file. when I'm including dependet classess, I use require_once to avoid multiple declarations - yet they happen. I put...
3
by: Tyno Gendo | last post by:
Has anyone come across this problem with require_once? I was working on my local machine with apache and have included a file like this: require_once "welcome_patient.php"; Works fine, the...
6
by: Shelly | last post by:
Here is a crazy question that has happend to me once before. I have an include file for the connection information to the server. It is like this: $hostname= "the_server_location"; $database...
3
by: Peter Wang | last post by:
Hi, all. I recently encountered a very annoying problem while using Zend Framework(ZF). We use ZF in our web application, and it works fine at the beginning, but later when concurrent...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.