Insert fails on access that I know works...

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

    #1

    Insert fails on access that I know works...


    Folks,

    I use PHP to write my form data to MySQL.

    I have a database with about ten tables. I'm trying to fill one table with
    some dummy data (its a contact manager table holding names of people,
    addresses and whatever but I'm createing random values for the moment). The
    insert fails telling me that access is denied - however I use the exact same
    username/password/database name/host name on the other tables, and the
    insert and updates work just fine.

    I know this sounds odd - but is there any other reason as to why I might get
    the access denied message, other than what I assume should be just for an
    invalid username/password?

    The following is a customized output of my error:

    Query failed
    Error Number 1044
    Message: Access denied for user: '@localhost' to database 'myDatabase'
    Comments:INSERT INTO myDatabase.cont actManager (title, firstname, initial,
    lastname, position, publisherHash, salutation, company, county, teldd,
    telfax, telddext, division, telsb, telsbext, telcell, telpager, telother,
    address1, address2, city, postcode, country, email, website, type) VALUES
    ("Ms", "Morpheus", "W", "YlastnameVFRE" , "Partner",
    "d98fb3d2476eaa 8da3957481e0946 109", "Dear Morpheus", "KcompanyQS JV",
    "BcountyLJS W", "251-823-1450", "251-479-4495", "35", "Vancouver" ,
    "251-682-5043", "883", "604-587-3284", "423-435-8301", "423-734-9771",
    "Apartment 777 - 9431 North Way", "South Coquitlam", "Nanaimo", "Q22E14",
    "CA", "btt@gxyphn.net ", "www.gxyphn.net ", "1")

    HOST= 192.168.1.2
    USER= myUser
    PASSWORD= myPassword
    NAME= myDatabase
    TABLE= contactManager

    Can anyone suggest one area that I could look at to help fix the problem?
    Pleaseeeeeee...

    many thanks,
    randelld


  • Daniel Tryba

    #2
    Re: Insert fails on access that I know works...

    Randell D. <you.can.email. me.at.randelld@ yahoo.com> wrote:[color=blue]
    > I have a database with about ten tables. I'm trying to fill one table with
    > some dummy data (its a contact manager table holding names of people,
    > addresses and whatever but I'm createing random values for the moment). The
    > insert fails telling me that access is denied - however I use the exact same
    > username/password/database name/host name on the other tables, and the
    > insert and updates work just fine.[/color]

    So you might have a permission problem, apparantly yhe user doens't have
    insert priveliges...
    [color=blue]
    > I know this sounds odd - but is there any other reason as to why I might get
    > the access denied message, other than what I assume should be just for an
    > invalid username/password?[/color]

    On the mysql site they have a whole page about this:
    http://www.mysql.com/doc/en/Access_denied.html

    --

    Daniel Tryba

    Comment

    • Randell D.

      #3
      Re: Insert fails on access that I know works...


      "Daniel Tryba" <news_comp.lang .php@canopus.nl > wrote in message
      news:bnn2gm$e7s $2@news.tue.nl. ..[color=blue]
      > Randell D. <you.can.email. me.at.randelld@ yahoo.com> wrote:[color=green]
      > > I have a database with about ten tables. I'm trying to fill one table[/color][/color]
      with[color=blue][color=green]
      > > some dummy data (its a contact manager table holding names of people,
      > > addresses and whatever but I'm createing random values for the moment).[/color][/color]
      The[color=blue][color=green]
      > > insert fails telling me that access is denied - however I use the exact[/color][/color]
      same[color=blue][color=green]
      > > username/password/database name/host name on the other tables, and the
      > > insert and updates work just fine.[/color]
      >
      > So you might have a permission problem, apparantly yhe user doens't have
      > insert priveliges...
      >[color=green]
      > > I know this sounds odd - but is there any other reason as to why I might[/color][/color]
      get[color=blue][color=green]
      > > the access denied message, other than what I assume should be just for[/color][/color]
      an[color=blue][color=green]
      > > invalid username/password?[/color]
      >
      > On the mysql site they have a whole page about this:
      > http://www.mysql.com/doc/en/Access_denied.html
      >
      > --
      >
      > Daniel Tryba
      >[/color]

      Thanks for pointing me to the documentation - but it didn't help me (though
      it might do in the future).

      The user does have insert privilages - I had mentioned this earlier in my
      post saying the same username and password worked for a different table in
      the same database on the same server...

      I think though I have solved it - Strangely, even though the message did
      point to access being denied, I believe the problem related to a column in
      the table that was suppoed to be unique, wasn't.

      I have a unique hash created for each record - I discovered that even after
      seeding a new random number sequence, the same md5 hash was created every
      time... I've changed the code and unique hashes are created everytime now,
      and the records seem to be writing just fine. So far, I've written four or
      five thousand records...

      Thanks for the prompt reply though...


      Comment

      • Daniel Tryba

        #4
        Re: Insert fails on access that I know works...

        Randell D. <you.can.email. me.at.randelld@ yahoo.com> wrote:[color=blue][color=green]
        >> On the mysql site they have a whole page about this:
        >> http://www.mysql.com/doc/en/Access_denied.html[/color]
        >
        > Thanks for pointing me to the documentation - but it didn't help me (though
        > it might do in the future).
        >
        > The user does have insert privilages - I had mentioned this earlier in my
        > post saying the same username and password worked for a different table in
        > the same database on the same server...[/color]

        Hmmmm, I forgot that access in mysql is per database and not per table
        :)
        [color=blue]
        > I think though I have solved it - Strangely, even though the message did
        > point to access being denied, I believe the problem related to a column in
        > the table that was suppoed to be unique, wasn't.
        >
        > I have a unique hash created for each record - I discovered that even after
        > seeding a new random number sequence, the same md5 hash was created every
        > time... I've changed the code and unique hashes are created everytime now,
        > and the records seem to be writing just fine. So far, I've written four or
        > five thousand records...[/color]

        Funny, normaly a more approriate error would occur (at least that is my
        experience).

        --

        Daniel Tryba

        Comment

        • Randell D.

          #5
          Re: Insert fails on access that I know works...


          "Daniel Tryba" <news_comp.lang .php@canopus.nl > wrote in message
          news:bnnalu$g7t $1@news.tue.nl. ..[color=blue]
          > Randell D. <you.can.email. me.at.randelld@ yahoo.com> wrote:[color=green][color=darkred]
          > >> On the mysql site they have a whole page about this:
          > >> http://www.mysql.com/doc/en/Access_denied.html[/color]
          > >
          > > Thanks for pointing me to the documentation - but it didn't help me[/color][/color]
          (though[color=blue][color=green]
          > > it might do in the future).
          > >
          > > The user does have insert privilages - I had mentioned this earlier in[/color][/color]
          my[color=blue][color=green]
          > > post saying the same username and password worked for a different table[/color][/color]
          in[color=blue][color=green]
          > > the same database on the same server...[/color]
          >
          > Hmmmm, I forgot that access in mysql is per database and not per table
          > :)
          >[color=green]
          > > I think though I have solved it - Strangely, even though the message did
          > > point to access being denied, I believe the problem related to a column[/color][/color]
          in[color=blue][color=green]
          > > the table that was suppoed to be unique, wasn't.
          > >
          > > I have a unique hash created for each record - I discovered that even[/color][/color]
          after[color=blue][color=green]
          > > seeding a new random number sequence, the same md5 hash was created[/color][/color]
          every[color=blue][color=green]
          > > time... I've changed the code and unique hashes are created everytime[/color][/color]
          now,[color=blue][color=green]
          > > and the records seem to be writing just fine. So far, I've written four[/color][/color]
          or[color=blue][color=green]
          > > five thousand records...[/color]
          >
          > Funny, normaly a more approriate error would occur (at least that is my
          > experience).
          >
          > --
          >
          > Daniel Tryba
          >[/color]

          I would agree - I though would think its more likely I unknowingly fixed
          more than one bug in my script than an error in MySQL...

          Thanks for the help though...


          Comment

          Working...