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

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

    Join Date
    May 2011
    Posts
    220
    Thanks given
    53
    Thanks received
    21
    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
    327
    Thanks given
    130
    Thanks received
    17
    Rep Power
    6
    Add these 2 imports into commands.java
    If that didnt work add my msn: [Only registered and activated users can see links. ]
    Code:
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jan 2012
    Posts
    58
    Thanks given
    0
    Thanks received
    3
    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
    327
    Thanks given
    130
    Thanks received
    17
    Rep Power
    6
    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 given
    0
    Thanks received
    3
    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
    89
    Thanks given
    20
    Thanks received
    5
    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)


User Tag List

Similar Threads

  1. Vote4cash!
    By Someone in forum Help
    Replies: 9
    Last Post: 12-10-2011, 07: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, 06:20 AM
  4. [PI] Vote4Cash Help
    By Dell in forum Help
    Replies: 8
    Last Post: 01-03-2011, 06:31 PM
  5. vote4cash
    By jessie thompson in forum Help
    Replies: 5
    Last Post: 11-27-2010, 11: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
  •