Subject: can't connect to mysql using pear
Posted By: sam Post Date: 9/16/2003 3:14:09 PM
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();

?>

Reply By: rob.weaver Reply Date: 9/18/2003 4:11:04 PM
Please post what DB.php states in your

require_once

statement

Thanks

Reply By: sam Reply Date: 9/18/2003 4:23:28 PM
I found out the problem it had to do with the way I was including the file thanks your intrest.

Go to topic 1098

Return to index page 1043
Return to index page 1042
Return to index page 1041
Return to index page 1040
Return to index page 1039
Return to index page 1038
Return to index page 1037
Return to index page 1036
Return to index page 1035
Return to index page 1034