Unknown column in 'field list' - MYSQL HELP

Discussion in 'Plugin Development' started by TedTheTechie, Jun 12, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    TedTheTechie

  2. Offline

    sirantony

    Don't you have to put a ';' after each SQL statement? Cause you didn't put one after the both executeUpdate statements.

    But I think it's because you set '' around a number. Use '' only for strings!!!

    So this:

    Code:java
    1. statement.executeUpdate("INSERT INTO `ranks` (`Name`,`playerrank`) VALUES ('"+pname+ "','1');");


    becomes this:

    Code:java
    1. statement.executeUpdate("INSERT INTO `ranks` (`Name`,`playerrank`) VALUES ('"+pname+ "',1);");


    Anyway, why do you have 2 different tables? You could but them into one...
     
  3. Offline

    TedTheTechie

    Thanks for helping!

    Also, I have seperate tables for them cause I like it like that :p
     
  4. Offline

    Garris0n

    1. You really shouldn't remove your code once somebody helps you.
    2. I can see from @sirantony's post that you're not using prepared statements. Use prepared statements.
     
  5. Offline

    TedTheTechie

    Garris0n

    1. It's code for a private plugin. I'm not giving it away.
    2. I know.
     
  6. Offline

    1Rogue


    But you already gave it away by asking for help on here...

    That and if you're not capable of solving your own problems I would say that the code isn't really outstandingly exceptional enough that you would have to hide it.
     
    Garris0n likes this.
  7. Offline

    xTigerRebornx

    Garris0n 1Rogue Well, he did have his MySQL DB information hardcoded (User, PW, IP, etc) into the code provided, but that doesn't mean he can't just remove that.
     
  8. Offline

    Garris0n

    He should not have posted that in the first place...
     
    1Rogue likes this.
  9. Offline

    Ultimate_n00b

    From what I see, I think you need to look into prepared statements :p just putting values into the query can lead to your database being injected.
     
  10. Offline

    JaguarJo

    And locked. Even though you edited the original post to remove all the information, we still do not support unofficial builds. If you're going to use other software, then you should be seeking support from the people who make it.
     
Thread Status:
Not open for further replies.

Share This Page