Thread: Highscores Error

Results 1 to 2 of 2
  1. #1 Highscores Error 
    Banned
    Join Date
    Dec 2014
    Posts
    69
    Thanks given
    3
    Thanks received
    1
    Rep Power
    0
    I was working on bootstrap highscores and got this error:

    Fatal error: Call to a member function execute() on a non-object in /home3/mag3rpwn/public_html/Destined-Reality.com/highscores/incl/classes/database.class.php on line 51

    Can someone help?

    This is the error Method:

    Code:
    public function getAllUsers($skill, $min) {
    		$stmt = $this->con->prepare("SELECT * FROM $this->table ORDER BY $skill DESC LIMIT $min, 25");
    		$stmt->execute();
    		return $stmt->fetchAll(PDO::FETCH_ASSOC);
    	}

    This is the error Server sided:

    Code:
    at rs2.highscores.Database.executeQuery(Database.java:62)
    	at rs2.highscores.Highscores.run(Highscores.java:24)
    	at java.lang.Thread.run(Thread.java:745)
    Link 62 for Database

    Code:
    public ResultSet executeQuery(String query) {
            try {
            	this.stmt = this.conn.createStatement(1005, 1008);
                ResultSet results = stmt.executeQuery(query);
                return results;
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
            return null;
        }
    This is the run method in Highscores

    Code:
    @Override
    	public void run() {
    		try {
    			Database db = new Database("hide", "hide.", "hide", "hide");
    		
    			String name = player.playerName.replace("_", " ");
    			
    			ResultSet rs = db.executeQuery("SELECT * FROM hs_users WHERE username='"
    					+ name + "' LIMIT 1");
    			
    			if (!db.init()) {
    				System.err.println("Failing to update "+name+" highscores. Database could not connect.");
    				return;
    			}
    			
    			PreparedStatement stmt1 = db.prepare("DELETE FROM hs_users WHERE username=?");
    			stmt1.setString(1, name);
    			stmt1.execute();
    				
    			PreparedStatement stmt2 = db.prepare(generateQuery());
    			stmt2.setString(1, name);
    			stmt2.setInt(2, player.getRank());
    			stmt2.setLong(3, player.getTotalExp());
    			
    			for (int i = 0; i < player.playerXP.length; i++) {
    
    				String skillName = Player.skillNames[i].toLowerCase();
    
    				if (skillName == "") {
    					continue;
    				}
    
    				rs.updateInt(skillName + "_xp", player.playerXP[i]);
    			}
    			
    			db.destroyAll();
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    	}
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Nov 2014
    Posts
    611
    Thanks given
    180
    Thanks received
    156
    Rep Power
    0
    It looks like a database error to me.
    Make sure your columns are setup properly.

    If you can't fix it yourself, contact me on Skype.
    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. MySQL highscores error
    By Escaped in forum Application Development
    Replies: 10
    Last Post: 06-19-2010, 01:39 AM
  2. Replies: 5
    Last Post: 06-11-2010, 01:35 PM
  3. [Insanity] Highscore errors
    By PaNiiC Joe in forum Help
    Replies: 9
    Last Post: 06-03-2010, 05:51 PM
  4. highscores error help
    By bobetoe in forum Help
    Replies: 0
    Last Post: 05-13-2010, 03:36 AM
  5. MYSQL dodian highscores error
    By Rukin1 in forum Application Development
    Replies: 7
    Last Post: 08-26-2009, 11:56 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
  •