require_once DB.php Help.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • richm
    New Member
    • Feb 2007
    • 2

    #1

    require_once DB.php Help.

    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@comrefh vac.com
    <?php
    require_once "DB.php";
    require "db.inc";

    $dsn = "mysql://{$username}:{$p assword}@{$host Name}/{$databaseName} ";

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

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

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

    if (DB::isError($r esult))
    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_FE TCHMODE_ASSOC))
    {
    // Print out each element in $row, that is, print the values of
    // the attributes
    foreach ($row as $attribute)
    print "{$attribut e}";

    print "\n";
    }
    ?>
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    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

    Comment

    Working...