PHP/mySQL freakish error

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

    PHP/mySQL freakish error

    I have never in my life ever seen this happen, but I am doing a typical
    mySQL insert statement:

    insert into nnet_usermetada ta (
    ...
    ) values (
    .....
    )

    if (!mysql_query(s ql)) { // DO STUFF}

    the ID column field, nnet_userid, is an int auto-increment.

    This is where I have never in my career seen this happen before. The INSERT
    statement, upon execution, literally writes on top of another existing row,
    so instead of 5 or 6 rows I have only 1 row, same ID, values changed!

    The way it works is that once a new user is pre-registered, their
    information is stored in the db, a cookie is set with their userID (the
    infamous permanent cookie) and then they're shown a screen w/ link to click
    to go to the next page. They can then click onto the "Registrer" link and
    edit their pre-registration information based upon the cookie stored in
    their machine and submit. Once submitted this time it updates their
    information instead of inserts.

    I've checked my code and writing on top of an existing row should NOT happen
    unless a cookie is set on their machine with their userid. In short, if I
    pre-register for the first time I should have a cookie with userid of 1. If
    Sven pre-registers for the first time on HIS machine he should have a cookie
    with userid of 2. and so on.

    So, uh, HELP!

    Phil


  • anti-bozak

    #2
    Re: PHP/mySQL freakish error

    your code probably has errors
    why dont you let us see so we can help you more?

    "Phil Powell" <soazine@erols. com> wrote in message
    news:3Q26b.1220 81$xf.26618@lak eread04...[color=blue]
    > I have never in my life ever seen this happen, but I am doing a typical
    > mySQL insert statement:
    >
    > insert into nnet_usermetada ta (
    > ...
    > ) values (
    > ....
    > )
    >
    > if (!mysql_query(s ql)) { // DO STUFF}
    >
    > the ID column field, nnet_userid, is an int auto-increment.
    >
    > This is where I have never in my career seen this happen before. The[/color]
    INSERT[color=blue]
    > statement, upon execution, literally writes on top of another existing[/color]
    row,[color=blue]
    > so instead of 5 or 6 rows I have only 1 row, same ID, values changed!
    >
    > The way it works is that once a new user is pre-registered, their
    > information is stored in the db, a cookie is set with their userID (the
    > infamous permanent cookie) and then they're shown a screen w/ link to[/color]
    click[color=blue]
    > to go to the next page. They can then click onto the "Registrer" link and
    > edit their pre-registration information based upon the cookie stored in
    > their machine and submit. Once submitted this time it updates their
    > information instead of inserts.
    >
    > I've checked my code and writing on top of an existing row should NOT[/color]
    happen[color=blue]
    > unless a cookie is set on their machine with their userid. In short, if I
    > pre-register for the first time I should have a cookie with userid of 1.[/color]
    If[color=blue]
    > Sven pre-registers for the first time on HIS machine he should have a[/color]
    cookie[color=blue]
    > with userid of 2. and so on.
    >
    > So, uh, HELP!
    >
    > Phil
    >
    >[/color]


    Comment

    • Fred

      #3
      Re: PHP/mySQL freakish error

      anti-bozak wrote:
      [color=blue]
      > your code probably has errors
      > why dont you let us see so we can help you more?
      >[/color]

      Particulary the definition for this particular table. To Phil: have you
      tried doing a dump of the actual SQL statements that you are sending to
      your server? Many problems arise there that becomes rather obvious looking
      at the raw SQL statements directly.

      -Fred

      --
      Shameless plug:

      A database of high-tech firms at your fingertips.

      Comment

      • Paul Bramscher

        #4
        Re: PHP/mySQL freakish error

        The immediate red-flag I see is that (sql) should probably be ($sql), eh?

        -Paul Bramscher


        Phil Powell wrote:[color=blue]
        > I have never in my life ever seen this happen, but I am doing a typical
        > mySQL insert statement:
        >
        > insert into nnet_usermetada ta (
        > ...
        > ) values (
        > ....
        > )
        >
        > if (!mysql_query(s ql)) { // DO STUFF}
        >
        > the ID column field, nnet_userid, is an int auto-increment.
        >
        > This is where I have never in my career seen this happen before. The INSERT
        > statement, upon execution, literally writes on top of another existing row,
        > so instead of 5 or 6 rows I have only 1 row, same ID, values changed!
        >
        > The way it works is that once a new user is pre-registered, their
        > information is stored in the db, a cookie is set with their userID (the
        > infamous permanent cookie) and then they're shown a screen w/ link to click
        > to go to the next page. They can then click onto the "Registrer" link and
        > edit their pre-registration information based upon the cookie stored in
        > their machine and submit. Once submitted this time it updates their
        > information instead of inserts.
        >
        > I've checked my code and writing on top of an existing row should NOT happen
        > unless a cookie is set on their machine with their userid. In short, if I
        > pre-register for the first time I should have a cookie with userid of 1. If
        > Sven pre-registers for the first time on HIS machine he should have a cookie
        > with userid of 2. and so on.
        >
        > So, uh, HELP!
        >
        > Phil
        >
        >[/color]

        Comment

        Working...