#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    13
    Rep Power
    0

    Angry I get this error: Column count doesn't match value count at row 1


    i get this error:Column count doesn't match value count at row 1

    with this code:
    $q = "INSERT INTO `auth` (`username`,`guid`) VALUES ('".$_GET["username"].",".$_GET["guid"]."')";
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,496
    Rep Power
    594
    What does this give you:
    PHP Code:
    $q "INSERT INTO `auth` (`username`,`guid`) VALUES ('".$_GET["username"].",".$_GET["guid"]."')";
    echo 
    $q
    I'm betting one of the $_GET values is null. Also I sure hope you are using prepared statements for that query or you are leaving yourself wide open to injections.

    P.S. Note the use of [ PHP ] tags.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    13
    Rep Power
    0
    PHP Code:
    INSERT INTO `auth` (`username`,`guid`) VALUES ('tyler_long_sim,1'
    FIX IT NOW !!!
    FIXED IT NOW!!!

    Comments on this post

    • Jacques1 disagrees : Who do you think you are?
    • Jyncka disagrees
    • requinix agrees : counter
    • ManiacDan agrees : Adding some rep, two letters can really change a message's meaning!
    Last edited by requinix; January 17th, 2013 at 02:30 AM. Reason: changing the <strike>s to [strike]s
  6. #4
  7. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    edit: After this, I withdraw my reply:

    Originally Posted by tyler_long_sim
    FIX IT NOW !!!
    Last edited by Jacques1; January 16th, 2013 at 02:42 PM.
  8. #5
  9. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,113
    Rep Power
    9398
    Originally Posted by tyler_long_sim
    PHP Code:
    INSERT INTO `auth` (`username`,`guid`) VALUES ('tyler_long_sim,1'
    FIX IT NOW !!!
    Dude, relax.
  10. #6
  11. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,113
    Rep Power
    9398
    I take it you guys haven't noticed it's his own thread and that he was yelling at himself?
  12. #7
  13. Put a potato on it!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Location
    Maryland
    Posts
    304
    Rep Power
    971
    Nope, didn't realize that, in which case I apologize for my disagree, though I don't think I de-rep'd
    "Those who can make you believe absurdities can make you commit atrocities."
  14. #8
  15. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,113
    Rep Power
    9398
    Truth be told I didn't notice until after I re-repped him (and only enough to bring him out of the negatives).

    Tyler, I removed the warning you got. Sorry about that but... I'm sure you can understand.
  16. #9
  17. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Of course it's his own thread, but why would he yell "fix it" at himself?

    If it was really just a very weird kind of, um, "self motivation", I also apologize. It sounded like rude pushing.
  18. #10
  19. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,113
    Rep Power
    9398
  20. #11
  21. Known to taste like chicken
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    In front of my computer
    Posts
    399
    Rep Power
    312
    Originally Posted by requinix
    I take it you guys haven't noticed it's his own thread and that he was yelling at himself?
    It is also possible he meant to say "FIXED IT NOW!!!"... just sayin...


    Incase he hasn't fixed it, the issue is a couple of missing apostrophes (I am assuming this is what Jaques1 had as a solution).

    PHP Code:
    //his code
    $q "INSERT INTO `auth` (`username`,`guid`) VALUES ('".$_GET["username"].",".$_GET["guid"]."')";

    //fixed code:
    $q "INSERT INTO `auth` (`username`,`guid`) VALUES ('".$_GET["username"]."','".$_GET["guid"]."')"
    edit: Also, using $_GET directly into db queries leaves you very open to SQL injection. It would be worth looking into using prepared statements instead, or at least sanitising your input data.
    Last edited by sir_drinxalot; January 16th, 2013 at 07:48 PM. Reason: sql injection note
    "Take thy beak from out my heart, and take thy form from off my door" - Homer J Simpson / Edgar Allan Poe

    Looking for a project Idea?
  22. #12
  23. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    13
    Rep Power
    0
    thanks guys,

    i was meant to put FIXED IT NOW!!!

    sorry

    Comments on this post

    • sir_drinxalot agrees : +20 on the right person this time!
    • Jyncka agrees : To make up for my previous reaction and because you got it working!
  24. #13
  25. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,113
    Rep Power
    9398
    Originally Posted by tyler_long_sim
    thanks guys,

    i was meant to put FIXED IT NOW!!!

    sorry
    That makes a lot more sense

    I'd consider it a personal favor if somebody repped him the +10 to get him back to where he was...

    Comments on this post

    • sir_drinxalot agrees : +20 for good measure :)
  26. #14
  27. Known to taste like chicken
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    In front of my computer
    Posts
    399
    Rep Power
    312
    lolz, totally rep'd requinix by accident...
    "Take thy beak from out my heart, and take thy form from off my door" - Homer J Simpson / Edgar Allan Poe

    Looking for a project Idea?
  28. #15
  29. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    Thanks for double-checking me Requinix. Tyler's well on his way to a higher rep now. Sometimes only a couple of letters can make all the difference.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo