Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 16th, 2003, 03:14 PM
sam sam is offline
Authorized User
 
Join Date: Jun 2003
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default can't connect to mysql using pear

I'm having trouble with the dsn the whole page dies after printing echo('3'."<BR>"); any suggestions

<?php

    require_once("/home/virtual/site110/fst/usr/share/pear/DB.php");


    $user = 'cc';
    $pass = '123';
    $host = 'localhost';
    $db_name = 'cc_org_-_1';

    echo('1'."<BR>");
    // Data Source Name: This is the universal connection string
    $dsn = "mysql://$user:$pass@$host/$db_name";

    echo('2'."<BR>");
    echo($dsn."<BR>");
    echo('3'."<BR>");

    $db = DB::connect($dsn);

    echo('4'."<BR>");

    if (DB::isError($db))

    {
        die ($db->getMessage());
    }

    $res = $db->query("SELECT admin_user_name FROM cc_admin_users");
    // Get each row of data on each iteration until
    // there are no more rows
    while ($row = $res->fetchRow())
    {
        $name = $row[0];
        echo($name);
    }

    $db->disconnect();

?>
__________________
~~~~~~~~~~~~~~~~~~~~~~~
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http://ebcpro.com.com
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;where EveryBusinessCounts
~~~~~~~~~~~~~~~~~~~~~~~
 
Old September 18th, 2003, 04:11 PM
Registered User
 
Join Date: Sep 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please post what DB.php states in your

require_once

statement

Thanks

 
Old September 18th, 2003, 04:23 PM
sam sam is offline
Authorized User
 
Join Date: Jun 2003
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found out the problem it had to do with the way I was including the file thanks your intrest.





Similar Threads
Thread Thread Starter Forum Replies Last Post
PEAR::Auth and PEAR::Auth_HTTP Ceriwaen Beginning PHP 1 February 18th, 2005 04:36 PM
pear db::connect turing PHP Databases 1 September 15th, 2004 05:22 PM
Best way to connect to mySQL netdaviso Java Databases 1 April 5th, 2004 06:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.