No luck making a databast connection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Julian Wright

    No luck making a databast connection

    I've included db.php into my script, and this is all it contains:

    $host = 'localhost';
    $username = '***';
    $password = '***';
    $database = '***';
    $connection = mysql_pconnect( $host, $username, $password);
    $mysql_select_d b($database, $connection);

    obviously with the other fields filled out.

    My webhost tells me to use this script:

    $dbh=mysql_conn ect ("localhost" , "<USERNAME HERE>", "<PASSWORD HERE>") or
    die ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ("<TABLE NAME>");

    neither one of these methods work, actually - I get this error:
    [the contents of my db.php file here, in plain text!]No Database Selected

    Anyone know what I'm doing wrong?


  • Taliesson Wang

    #2
    Re: No luck making a databast connection

    [color=blue]
    >
    > $dbh=mysql_conn ect ("localhost" , "<USERNAME HERE>", "<PASSWORD HERE>") or
    > die ('I cannot connect to the database because: ' . mysql_error());
    > mysql_select_db ("<TABLE NAME>");[/color]
    ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^???
    should be:
    mysql_select_db ($database);[color=blue]
    >
    > neither one of these methods work, actually - I get this error:
    > [the contents of my db.php file here, in plain text!]No Database Selected
    >
    > Anyone know what I'm doing wrong?
    >[/color]
    Good luck this time!
    Wangs


    Comment

    • Julian Wright

      #3
      Re: No luck making a databast connection

      "Taliesson Wang" <wangii@163.net .no.spam> wrote in message
      news:bo7bfh$2so j$1@news.wplus. net...[color=blue]
      >[color=green]
      > >
      > > $dbh=mysql_conn ect ("localhost" , "<USERNAME HERE>", "<PASSWORD HERE>")[/color][/color]
      or[color=blue][color=green]
      > > die ('I cannot connect to the database because: ' . mysql_error());
      > > mysql_select_db ("<TABLE NAME>");[/color]
      > ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^???
      > should be:
      > mysql_select_db ($database);[color=green]
      > >
      > > neither one of these methods work, actually - I get this error:
      > > [the contents of my db.php file here, in plain text!]No Database[/color][/color]
      Selected[color=blue][color=green]
      > >
      > > Anyone know what I'm doing wrong?
      > >[/color]
      > Good luck this time!
      > Wangs[/color]

      That's what I've been doing

      doesn't work!


      Comment

      • Julian Wright

        #4
        Re: No luck making a databast connection


        "Taliesson Wang" <wangii@163.net .no.spam> wrote in message
        news:bo7bfh$2so j$1@news.wplus. net...[color=blue]
        >[color=green]
        > >
        > > $dbh=mysql_conn ect ("localhost" , "<USERNAME HERE>", "<PASSWORD HERE>")[/color][/color]
        or[color=blue][color=green]
        > > die ('I cannot connect to the database because: ' . mysql_error());
        > > mysql_select_db ("<TABLE NAME>");[/color]
        > ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^???
        > should be:
        > mysql_select_db ($database);[color=green]
        > >
        > > neither one of these methods work, actually - I get this error:
        > > [the contents of my db.php file here, in plain text!]No Database[/color][/color]
        Selected[color=blue][color=green]
        > >
        > > Anyone know what I'm doing wrong?
        > >[/color]
        > Good luck this time!
        > Wangs[/color]

        This is what i have, the database is empty, and it's just a testing server
        anyway, so you can have the username+passwo rd:

        $host = 'localhost';
        $username = 'yem_dbtest';
        $password = 'dbpass';
        $database = 'yem_testdb';

        $connection = mysql_connect($ host, $username, $password);

        //$mysql_select_d b($database, $connection);
        mysql_select_db ($database);

        Not working!!!
        This is what I have on my IE:

        $host = 'localhost'; $username = 'yem_dbtest'; $password = 'dbpass';
        $database = 'yem_testdb'; $connection = mysql_connect($ host, $username,
        $password); //$mysql_select_d b($database, $connection);
        mysql_select_db ($database); No Database Selected


        Comment

        • Dr.Bob

          #5
          Re: No luck making a databast connection

          > Not working!!![color=blue]
          > This is what I have on my IE:
          >
          > $host = 'localhost'; $username = 'yem_dbtest'; $password = 'dbpass';
          > $database = 'yem_testdb'; $connection = mysql_connect($ host, $username,
          > $password); //$mysql_select_d b($database, $connection);
          > mysql_select_db ($database); No Database Selected
          >
          >[/color]

          If *this* really is what your IE comes up with, than it's just that the
          page doesn't get parsed with PHP! Cause it's showing it as plain text.
          Is it a *.php file? And do other *.php files work for instance with only
          <?php phpinfo(); ?>

          stevijn
          // @
          // drbobco
          // .com


          Comment

          • Taliesson Wang

            #6
            Re: No luck making a databast connection

            >[color=blue]
            > $host = 'localhost'; $username = 'yem_dbtest'; $password = 'dbpass';
            > $database = 'yem_testdb'; $connection = mysql_connect($ host, $username,
            > $password); //$mysql_select_d b($database, $connection);
            > mysql_select_db ($database); No Database Selected
            >
            >[/color]
            seems that your php engine not work.
            check the doc type, maybe should be .php not .php3.

            T.Wang


            Comment

            Working...