Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 16th, 2003, 03:14 PM
sam sam is offline
Authorized User
 
Join Date: Jun 2003
Location: , , .
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
~~~~~~~~~~~~~~~~~~~~~~~
Reply With Quote
  #2 (permalink)  
Old September 18th, 2003, 04:11 PM
Registered User
 
Join Date: Sep 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please post what DB.php states in your

require_once

statement

Thanks

Reply With Quote
  #3 (permalink)  
Old September 18th, 2003, 04:23 PM
sam sam is offline
Authorized User
 
Join Date: Jun 2003
Location: , , .
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:13 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.