No database selected

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

    No database selected

    Hi all

    I'm running a pretty standard PHP page and it keeps coming up with 'No
    database selected'. It happens about 50% of the time and the rest of the
    time it works fine.

    There's a bug that describes this on the bugs.php.net site but not on the
    version that is being run on my customer's server which is 4.2.1. On the
    php site it's listed as a problem on 4.3.3 and there is a patch for it which
    seems to go to a broken link (Mind you, it's not my server so I'm stuffed on
    that front anyway).

    There is a workaround but I'm nervous about implementing it as it just loops
    until the error goes away. Fine if it goes quickly but I sat there earlier
    and refreshed about 50 time before it started working again.

    Anyone got any ideas?

    Andy


  • Alvaro G Vicario

    #2
    Re: No database selected

    *** AJ wrote/escribió (Thu, 16 Sep 2004 10:54:02 +0000 (UTC)):[color=blue]
    > I'm running a pretty standard PHP page and it keeps coming up with 'No
    > database selected'.[/color]

    Do you use and error-check mysql_select_db ()? Sorry for the question, but
    sometimes the answer is the simpliest.


    --
    -- Álvaro G. Vicario - Burgos, Spain
    -- Thank you for not e-mailing me your questions
    --

    Comment

    • AJ

      #3
      Re: No database selected


      "Alvaro G Vicario" <alvaro_QUITAR_ REMOVE@telecomp uteronline.com> wrote in
      message news:1id7sbtl6y 3s8.p2excuoiqd2 p.dlg@40tude.ne t...[color=blue]
      > *** AJ wrote/escribió (Thu, 16 Sep 2004 10:54:02 +0000 (UTC)):[color=green]
      > > I'm running a pretty standard PHP page and it keeps coming up with 'No
      > > database selected'.[/color]
      >
      > Do you use and error-check mysql_select_db ()? Sorry for the question, but
      > sometimes the answer is the simpliest.[/color]

      Nope, even simpler. I are stoopid!

      Code snippets...

      $database_FRED = "database";

      mysql_select_db ($database_BOB. ....

      Spot the deliberate mistake.

      What I STILL don't get is that it actually worked sometimes and not others.
      What I even more don't get is that on my testing server it ALWAYS worked.

      AJ


      Comment

      • Alvaro G Vicario

        #4
        Re: No database selected

        *** AJ wrote/escribió (Thu, 16 Sep 2004 12:46:57 +0000 (UTC)):[color=blue]
        > What I STILL don't get is that it actually worked sometimes and not others.
        > What I even more don't get is that on my testing server it ALWAYS worked.[/color]

        MySQL is famous for figuring out things when any other DBMS would just dump
        an error. Probably, when user had access to only one database it simply
        used that database.


        --
        -- Álvaro G. Vicario - Burgos, Spain
        -- Thank you for not e-mailing me your questions
        --

        Comment

        Working...