About Inserting values in the MYSQL database

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

    About Inserting values in the MYSQL database

    I am not beginer of this language. I've worked on this language for 2
    or 3 months.But now i have a problem to inserting values in the
    database.It gives me error that DATABASE NOT SELECTED.
    I am using wampserver.Plea se help me for this prob.
  • Gordon Burditt

    #2
    Re: About Inserting values in the MYSQL database

    >I am not beginer of this language. I've worked on this language for 2
    >or 3 months.But now i have a problem to inserting values in the
    >database.It gives me error that DATABASE NOT SELECTED.
    >I am using wampserver.Plea se help me for this prob.
    Then select a database.

    Do one of the following:

    (1) specify a database when using mysql_real_conn ect().
    (2) use mysql_select_db () after mysql_connect() . And it would be a
    good idea to check if it worked correctly before proceeding.

    Remember, you need to use a VALID database name, one you have privileges
    to access.

    Comment

    • Tim Roberts

      #3
      Re: About Inserting values in the MYSQL database

      Bunty <bunty.viradia0 @gmail.comwrote :
      >
      >I am not beginer of this language. I've worked on this language for 2
      >or 3 months.But now i have a problem to inserting values in the
      >database.It gives me error that DATABASE NOT SELECTED.
      >I am using wampserver.Plea se help me for this prob.
      Connecting to a MySQL database in PHP requires two steps: one to connect to
      the server (mysql_connect) , and one to select a database (mysql_select_d b).
      This is different from many other language/database bindings, where the
      connection string specifies the initial database.

      My guess is that you forgot mysql_select_db .
      --
      Tim Roberts, timr@probo.com
      Providenza & Boekelheide, Inc.

      Comment

      • C. (http://symcbean.blogspot.com/)

        #4
        Re: About Inserting values in the MYSQL database

        On 22 Aug, 07:23, Tim Roberts <t...@probo.com wrote:
        Bunty <bunty.virad... @gmail.comwrote :
        >
        I am not beginer of this language. I've worked on this language for 2
        or 3 months.But now i have a problem to inserting values in the
        database.It gives me error that DATABASE NOT SELECTED.
        I am using wampserver.Plea se help me for this prob.
        >
        Connecting to a MySQL database in PHP requires two steps: one to connect to
        the server (mysql_connect) , and one to select a database (mysql_select_d b).
        This is different from many other language/database bindings, where the
        connection string specifies the initial database.
        >
        My guess is that you forgot mysql_select_db .
        --
        Tim Roberts, t...@probo.com
        Providenza & Boekelheide, Inc.
        Actually, using mysql_select_db () or mysql_query("us e $db") can make
        life very complicated if you ever have to develop an application
        spanning more than one database.

        I've got into the habit of qualifying table names instead, e.g.

        SELECT app.* FROM my_db.app, mysql.user
        WHERE user.user=app.u ser

        C.

        Comment

        • Jerry Stuckle

          #5
          Re: About Inserting values in the MYSQL database

          C. (http://symcbean.blogspot.com/) wrote:
          On 22 Aug, 07:23, Tim Roberts <t...@probo.com wrote:
          >Bunty <bunty.virad... @gmail.comwrote :
          >>
          >>I am not beginer of this language. I've worked on this language for 2
          >>or 3 months.But now i have a problem to inserting values in the
          >>database.It gives me error that DATABASE NOT SELECTED.
          >>I am using wampserver.Plea se help me for this prob.
          >Connecting to a MySQL database in PHP requires two steps: one to connect to
          >the server (mysql_connect) , and one to select a database (mysql_select_d b).
          >This is different from many other language/database bindings, where the
          >connection string specifies the initial database.
          >>
          >My guess is that you forgot mysql_select_db .
          >--
          >Tim Roberts, t...@probo.com
          >Providenza & Boekelheide, Inc.
          >
          Actually, using mysql_select_db () or mysql_query("us e $db") can make
          life very complicated if you ever have to develop an application
          spanning more than one database.
          >
          I've got into the habit of qualifying table names instead, e.g.
          >
          SELECT app.* FROM my_db.app, mysql.user
          WHERE user.user=app.u ser
          >
          C.
          >
          Which can still be done, even if you use mysql_select_db ().

          However, if you find you are often spanning databases in your apps, you
          have a major database design problem.

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          • Jerry Stuckle

            #6
            Re: About Inserting values in the MYSQL database

            ally wrote:
            On Fri, 22 Aug 2008 08:46:44 -0400, Jerry Stuckle <jstucklex@attg lobal.net>
            wrote:
            >
            >However, if you find you are often spanning databases in your apps, you
            >have a major database design problem.
            >>
            >--
            >
            erm why?
            >
            >
            Databases are meant to keep all the information together in one set of
            tables. Spreading it out over multiple databases loses that concept.

            And while MySQL's "databases" are closer to "schemas" in other
            databases, the concept holds true there, also.

            It's also a lot easier to backup a single database, and even easier to
            change between a development and a production database - just change the
            name in one global variable.

            But this is getting off topic for a php newsgroup. More info can be
            found in a database-related newsgroup.

            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            • Gufo Rosso

              #7
              Re: About Inserting values in the MYSQL database

              Bunty ha scritto:
              I am not beginer of this language. I've worked on this language for 2
              or 3 months.But now i have a problem to inserting values in the
              database.It gives me error that DATABASE NOT SELECTED.
              I am using wampserver.Plea se help me for this prob.

              please read OFFICIAL manual and use "copy and paste"
              _all example works_




              Comment

              • The Natural Philosopher

                #8
                Re: About Inserting values in the MYSQL database

                ally wrote:
                On Fri, 22 Aug 2008 08:46:44 -0400, Jerry Stuckle <jstucklex@attg lobal.net>
                wrote:
                >
                >However, if you find you are often spanning databases in your apps, you
                >have a major database design problem.
                >>
                >--
                >
                erm why?
                >
                Cos jerry says so.

                He obviously hasn't had to do what a certain person of my acquaintance
                does for a living..interro gate multiple criminal databases across
                several police forces and present an integrated view on data to the
                detectives...II RC he does indeed use php as well.


                Comment

                • John W Kennedy

                  #9
                  Re: About Inserting values in the MYSQL database

                  The Natural Philosopher wrote:
                  ally wrote:
                  >On Fri, 22 Aug 2008 08:46:44 -0400, Jerry Stuckle
                  ><jstucklex@att global.net>
                  >wrote:
                  >>
                  >>However, if you find you are often spanning databases in your apps,
                  >>you have a major database design problem.
                  >>>
                  >>--
                  >>
                  >erm why?
                  >>
                  Cos jerry says so.
                  >
                  He obviously hasn't had to do what a certain person of my acquaintance
                  does for a living..interro gate multiple criminal databases across
                  several police forces and present an integrated view on data to the
                  detectives...II RC he does indeed use php as well.
                  Ambiguity on the word "database" here, I rather fancy.
                  --
                  John W. Kennedy
                  "The bright critics assembled in this volume will doubtless show, in
                  their sophisticated and ingenious new ways, that, just as /Pooh/ is
                  suffused with humanism, our humanism itself, at this late date, has
                  become full of /Pooh./"
                  -- Frederick Crews. "Postmodern Pooh", Preface

                  Comment

                  • Jerry Stuckle

                    #10
                    Re: About Inserting values in the MYSQL database

                    sool wrote:
                    On Fri, 22 Aug 2008 13:44:34 -0400, Jerry Stuckle <jstucklex@attg lobal.net>
                    wrote:
                    >
                    >ally wrote:
                    >>On Fri, 22 Aug 2008 08:46:44 -0400, Jerry Stuckle <jstucklex@attg lobal.net>
                    >>wrote:
                    >>>
                    >>>However, if you find you are often spanning databases in your apps, you
                    >>>have a major database design problem.
                    >>>>
                    >>>--
                    >>erm why?
                    >>>
                    >>>
                    >Databases are meant to keep all the information together in one set of
                    >tables. Spreading it out over multiple databases loses that concept.
                    >>
                    >And while MySQL's "databases" are closer to "schemas" in other
                    >databases, the concept holds true there, also.
                    >>
                    >It's also a lot easier to backup a single database, and even easier to
                    >change between a development and a production database - just change the
                    >name in one global variable.
                    >
                    Clearly you are not conversant with how many real world situations operate.
                    Multiple database access is essential. Perhaps less time spent dealing with
                    small WWW site applications and more with the more professional and larger
                    situations would help you understand why that is approaching a "daft" response.
                    >
                    sool
                    -----------------------
                    >
                    >
                    >
                    >
                    >
                    I am VERY conversant with how real world situations operate - I've been
                    programming for over 40 years (including 13 years with IBM on large
                    mainframes), and an independent consultant for the last 18. My
                    experience predates the web by almost 25 years, and some of the
                    databases I've worked on are larger than anyone here has probably ever seen.

                    I started designing SQL databases back in the mid 80's - almost 25 years
                    ago. I have designed some databases larger than you would ever dream.
                    Of course, this has been on mainframes, not PC's.

                    But it's also clear from your response you have no real idea about how
                    to design a database correctly. You've probably never worked with
                    anything outside of PC's, MySQL and PHP. And you have no idea what
                    you're talking about.

                    --
                    =============== ===
                    Remove the "x" from my email address
                    Jerry Stuckle
                    JDS Computer Training Corp.
                    jstucklex@attgl obal.net
                    =============== ===

                    Comment

                    Working...