Hello Peeps

Please help im going nuts.

I have running a local FreeBSD server

On it is the usuals php/mysql

I have installed pear and I am tring to get it to work.

I have all the correct paths etc but im getting errors connecting to it. Here is my snippet code.

include_once("DB.php");
$dbh = DB::connect("mysql://root:password1@localhost/databasename");

This does not work so I have tried this

dsn = 'mysql://root:standby1@localhost/boxedunique';
$db = DB::Connect($dsn);
if (DB::IsError($db)) die($db->getMessage());

and this still does not work. Im getting this error in my window.

Warning: Problem with method call - please report this bug in /vhosts/database/htdocs/tutorial.php on line 14

Can anyone please help.

Thankyou if you can

    I have tried it all different ways

    This bit of code is the problem

    $db = DB::connect

    It does not like it

    This is also what I have tried
    ////////////////////////////////////
    config.php
    $DB_host = "localhost"; // the hostname of the database server
    $DB_user = "name"; // the username to connect with
    $DB_pass = "passy"; // the user's password
    $DB_dbName = "d_base"; // the name of the database to connect to
    $DB_dbType = "mysql"; // the type of database server.
    //////////////////////////////////////////
    tutorial.php

    include_once("config.inc.php");
    include_once(APP_INC_PATH . "class.template.php");

    $tpl = new Template_API();
    $tpl->setTemplate("tutorial.tpl.html");

    include_once("DB.php");

    $dsn = $DB_dbType . "://" // Build a DSN string (Data Source Name)
    . $DB_user . ":" // Required by DB::connect()
    . $DB_pass . "@"
    . $DB_host . "/"
    . $DB_dbName;

    $db = DB::connect($dsn, TRUE); // Creates a database connection object in $db
    // or, a database error object if it went wrong.
    // The boolean specifies this is a persistent
    // connection like mysql_pconnect(), it
    // defaults to FALSE.

    if (DB::isError($db)) { // Check whether the object is a connection or
    // an error.
    die($db->getMessage()); // Print out a message and exit if it's
    // an error object.

    etc..

    But the error is on the same type of line error $db = DB::connect
    Any idea why ?

      are you sure that the include() is working?

        Write a Reply...