Thread: [PI] Vote4cash command (cyb3rs vote4cash) [+REP]

Results 1 to 6 of 6
  1. #1 [PI] Vote4cash command (cyb3rs vote4cash) [+REP] 
    Donator


    Join Date
    May 2011
    Posts
    217
    Thanks
    50
    Thanked 21 Times in 19 Posts
    Rep Power
    89
    How can i fix this?

    I tried driver managers getconnection but it would work, i have correct imports.

    These are the only three errors i get:

    Code:
    src\server\model\players\packets\Commands.java:730: cannot find symbol
    symbol  : variable database
    location: class server.model.players.packets.Commands
                                            PreparedStatement ps = database.getConne
    ction().prepareStatement("SELECT * FROM votes WHERE username = ? AND used = '1'
    LIMIT 1");
                                                                   ^
    src\server\model\players\packets\Commands.java:737: cannot find symbol
    symbol  : variable database
    location: class server.model.players.packets.Commands
                                                    ps = database.getConnection().pr
    epareStatement("SELECT * FROM votes WHERE authcode = ? AND used = '0' LIMIT 1");
    
                                                         ^
    src\server\model\players\packets\Commands.java:742: cannot find symbol
    symbol  : variable database
    location: class server.model.players.packets.Commands
                                                            ps = database.getConnect
    ion().prepareStatement("UPDATE votes SET used = '1' WHERE authcode = ?");
                                                                 ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    3 errors
    Press any key to continue . . .
    The command :

    Code:
    		if (playerCommand.startsWith("auth") && playerCommand.length() > 5) {
    			if (!Config.MYSQL_ACTIVE) {
    				c.sendMessage("Sorry this is currently disabled.");
    				return;
    			} else {
    				try {
    					PreparedStatement ps = Database.getConnection().prepareStatement("SELECT * FROM votes WHERE username = ? AND used = '1' LIMIT 1");
    					ps.setString(1, c.playerName);
    					ResultSet results = ps.executeQuery();
    					if(results.next()) {
    						c.sendMessage("You have already voted once today.");
    					} else {
    						ps.close();
    						ps = Database.getConnection().prepareStatement("SELECT * FROM votes WHERE authcode = ? AND used = '0' LIMIT 1");
    						ps.setString(1, playerCommand.substring(5));
    						results = ps.executeQuery();
    						if(results.next()) {
    							ps.close();
    							ps = Database.getConnection().prepareStatement("UPDATE votes SET used = '1' WHERE authcode = ?");
    							ps.setString(1, playerCommand.substring(5));
    							ps.executeUpdate();
    							//givem the reward
    							c.sendMessage("Thank you for voting.");
    						} else {
    							c.sendMessage("The auth code is not valid!");
    						}
    					}
    					ps.close();
    				} catch (Exception e) {
    					e.printStackTrace();
    				}
    			}
    			return;
    		}
    Thanks in advance :]!
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Sep 2011
    Posts
    47
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    11
    Add these 2 imports into commands.java
    If that didnt work add my msn: toomuchpkeco@hotmail.com
    Code:
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jan 2012
    Posts
    58
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Rep Power
    22
    You are missing single quote's from the votes string and you are not selecting anything, it should be SELECT selectingwhatever here not * FROM 'votes'

    Have I helped you? Don't post a thanks, there's a button for it.

    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Sep 2011
    Posts
    47
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    11
    Quote Originally Posted by iJordan View Post
    You are missing single quote's from the votes string and you are not selecting anything, it should be SELECT selectingwhatever here not * FROM 'votes'
    NO thats wrong... He was missing imports.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jan 2012
    Posts
    58
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Rep Power
    22
    If you say so, but also the layout of the MySQL is wrong.

    Have I helped you? Don't post a thanks, there's a button for it.

    Reply With Quote  
     

  6. #6  
    Banned
    Join Date
    Jan 2012
    Posts
    78
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Rep Power
    0
    link to tut?
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Vote4cash!
    By Someone in forum Help
    Replies: 9
    Last Post: 12-10-2011, 06:26 PM
  2. [$15] Vote4Cash
    By Linksbro in forum Requests
    Replies: 4
    Last Post: 04-19-2011, 01:21 AM
  3. vote4cash help
    By skilling in forum Help
    Replies: 0
    Last Post: 02-06-2011, 05:20 AM
  4. [PI] Vote4Cash Help
    By Dell in forum Help
    Replies: 8
    Last Post: 01-03-2011, 05:31 PM
  5. vote4cash
    By jessie thompson in forum Help
    Replies: 5
    Last Post: 11-27-2010, 10:44 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •