Bid for items

Results 1 to 6 of 6
  1. #1
    Account Upgraded | Title Enabled! Carrino is offline
    MemberRank
    Mar 2010 Join Date
    1,114Posts

    Bid for items

    Not so stable..
    PHP Code:
    CREATE TABLE `bubblesdev`.`bid` (
      `
    bidINT(11NOT NULL DEFAULT 0,
      `
    itemINT(11NOT NULL DEFAULT 0,
      
    PRIMARY KEY (`bid`)
    )
    ENGINE InnoDB
    PHP Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */

    package client;

    import com.mysql.jdbc.Connection;
    import com.mysql.jdbc.PreparedStatement;
    import java.sql.SQLException;
    import tools.DatabaseConnection;


    /**
     *
     * @author Carrino
     */
    public class Bid {
       private 
    int bid;
       private 
    int item;
      public 
    void setbid ()  throws SQLException  {
           
    Connection con = (ConnectionDatabaseConnection.getConnection();
           
    PreparedStatement ps = (PreparedStatementDatabaseConnection.getConnection().prepareStatement("INSERT INTO bid (`bid`) VALUES (?))");
           
    ps.setInt(1bid);
           
    ps.executeUpdate();
           
    ps.close();
    }
      public 
    int getbid () {    
        return 
    bid;
    }
      public 
    void setitem() throws SQLException {
          
    Connection con = (ConnectionDatabaseConnection.getConnection();
           
    PreparedStatement ps = (PreparedStatementDatabaseConnection.getConnection().prepareStatement("INSERT INTO bid (`item`) VALUES (?))");
           
    ps.setInt(1item);
           
    ps.executeUpdate();
           
    ps.close();
      }
      public 
    int getitem() {
          return 
    item;
      } 
      public 
    void playergetitem (MapleClient c) {
    c.getPlayer().gainItem(item, (short) -1);
      }

    Dont like dont use, dont like gtfo
    Dont ask me what is this too.
    Tell me if there's any error

    And remember, leeching this will be a waste of effort.
    You need to know what is this before you copy this bunch of code.


  2. #2
    Account Upgraded | Title Enabled! Sactual is offline
    MemberRank
    Jan 2010 Join Date
    Hong KongLocation
    212Posts

    Re: Bid for items

    I see.. calling a new instance of this class for every single bid. Why not just store it in a hash map.

  3. #3
    Infraction Banned Raymond.C is offline
    MemberRank
    Oct 2009 Join Date
    269Posts

    Re: Bid for items

    This just fucks over the stability in odin.

  4. #4
    Account Upgraded | Title Enabled! Carrino is offline
    MemberRank
    Mar 2010 Join Date
    1,114Posts

    Re: Bid for items

    Quote Originally Posted by Sactual View Post
    I see.. calling a new instance of this class for every single bid. Why not just store it in a hash map.
    I like classes:D

  5. #5
    while(true) spam(); kevintjuh93 is offline
    MemberRank
    Jun 2008 Join Date
    The NetherlandsLocation
    4,119Posts

    Re: Bid for items

    Quote Originally Posted by Carrino View Post
    I like classes:D
    I am so dam bored. HASHMAP PL0x?
    Last edited by kevintjuh93; 23-03-10 at 06:31 PM.

  6. #6
    Account Upgraded | Title Enabled! flav is offline
    MemberRank
    Jul 2008 Join Date
    655Posts

    Re: Bid for items

    Quote Originally Posted by Carrino View Post
    I like classes:D
    You can still cache, search for static on Google.



Advertisement