Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10

Thread: Data disappears

  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Data disappears

    I'm currently having problems with a gaming ladder script and specifically the register/validate part.

    A player will register and will have to validate via a code sent in e-mail. The username etc. are stored in the table 'validate'. Once validated the username etc. should be transferred to the 'users' table but this doesn't happen.

    The data is deleted from the 'validate' table but doesn't appear in 'users'

    The code can be seen at:

    http://pastebin.com/936959

    Any ideas?

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Before Fumigator has the opportunity (), why are you not validating your query with die(mysql_error())?

    It may show you why you are not inserting data (and hence, its disappearance) the way you are expecting.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Added that in and it says:

    Error: Column count doesn't match value count at row 1

  • #4
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    That's why you are "losing" data. There is a missing (or extra) column in one of your SQL statements, causing the statement to fail.

    Look over your SQL and make sure that you have the right number of columns in your INSERT.

    FOR EXAMPLE:

    If mytable has 13 columns, INSERT INTO myTable VALUES () needs to have 13 values in it, while INSERT INTO myTable (col1,col2,col3) VALUES () only needs to have 3 values in it.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #5
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Before Fumigator has the opportunity ( ), why are you not validating your query with die(mysql_error())?
    Oh man that made me laugh. You caught on to my mantra

  • #6
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Figured you needed a good chuckle.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #7
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Daemonspyre View Post
    That's why you are "losing" data. There is a missing (or extra) column in one of your SQL statements, causing the statement to fail.

    Look over your SQL and make sure that you have the right number of columns in your INSERT.

    FOR EXAMPLE:

    If mytable has 13 columns, INSERT INTO myTable VALUES () needs to have 13 values in it, while INSERT INTO myTable (col1,col2,col3) VALUES () only needs to have 3 values in it.
    Cheers. I didn't code the script myself.

    I added extra ones in make them equal but still get the same error.

    1. I'm guessing the coder put NULL in first as that would be the 'ID' column and is auto_increment. Would I be right?

    2. The last two fields are showing the attributes 'UNSIGNED'. Would this make a difference at all?

    I recently integrated the ladder with a forum so this is where the extra fields came from.


    EDIT: Okie. Not having a good day. I was saving the file but then uploading the original one again. Did it 4 times before I reliased. It's now working. Thanks for the help! Rep given.
    Last edited by BigBob; 06-26-2007 at 09:43 PM.

  • #8
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    1. You would be correct

    2. UNSIGNED means that the column will only accept numbers and will not accept negative numbers. Default for these is usually NULL or 0.

    Before you go adding columns to your scripts/tables, why not change your INSERT statements to include the field names?
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #9
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Daemonspyre View Post
    1. You would be correct

    2. UNSIGNED means that the column will only accept numbers and will not accept negative numbers. Default for these is usually NULL or 0.

    Before you go adding columns to your scripts/tables, why not change your INSERT statements to include the field names?
    Check my edit to last post ;-)

  • #10
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Sorry! Didn't see the EDIT till after.

    Thanks for the REP!
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •