Thread: voting stuck

Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1 voting stuck 
    Registered Member
    Join Date
    Sep 2011
    Posts
    22
    Thanks given
    9
    Thanks received
    0
    Rep Power
    11
    Hi,

    I don't get why I'm getting this error Im using the vote script from king fox this is the site here where I added to voting as well as the mysql

    https://runeline.com/vote/
    Reply With Quote  
     

  2. #2  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    It tells you the error:
    Table 'runeline_hd.fx_votes' doesn't exist in /home/runeline/public_html/vote/classes/class.database.php
    You are missing a table in your database.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Sep 2011
    Posts
    22
    Thanks given
    9
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by arch337 View Post
    It tells you the error:

    You are missing a table in your database.
    Code:
    Code:
    <?php
    class Database {
    
    	private $con;
    
    	private $host;
    	private $user;
    	private $pass;
    	private $data;
    
    	public function __construct($host, $user, $pass, $data) {
    		$this->host = $host;
    		$this->user = $user;
    		$this->pass = $pass;
    		$this->data = $data;
    	}
    
    	public function connect() {
    		try {
    			$this->con = new PDO('mysql:host='.$this->host.';dbname='.$this->data.';charset=utf8', $this->user, $this->pass);
    			$this->con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    			$this->con->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
    			return true;
    		} catch (Exception $e) {
    			echo 'Unable to connect to database. Please check credentials and try again.';
    			return false;
    		}
    	}
    
    	public function getSites() {
    		$stmt = $this->con->prepare("SELECT * FROM fx_sites WHERE active=1");
    		$stmt->execute();
    		return $stmt->fetchAll(PDO::FETCH_ASSOC);
    	}
    
    	public function getAllSites() {
    		$stmt = $this->con->prepare("SELECT * FROM fx_sites");
    		$stmt->execute();
    		return $stmt->fetchAll(PDO::FETCH_ASSOC);
    	}
    
    	public function getSite($value) {
    		$stmt = $this->con->prepare("SELECT * FROM fx_sites WHERE id=:value LIMIT 1");
    		$stmt->bindParam(":value", $value);
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function getSiteByIp($value) {
    		$stmt = $this->con->prepare("SELECT * FROM fx_sites WHERE ip_address=:value LIMIT 1");
    		$stmt->bindParam(":value", $value);
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function getSiteBy($column, $value) {
    		$stmt = $this->con->prepare("SELECT * FROM fx_sites WHERE $column=:value LIMIT 1");
    		$stmt->bindParam(":value", $value);
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function getVoteStats() {
    		$stmt = $this->con->prepare("SELECT COUNT(*) AS amount, MONTH(callback_date) AS month FROM fx_votes WHERE callback_date IS NOT NULL AND YEAR(callback_date) = YEAR(CURDATE()) GROUP BY month ORDER BY month ASC");
    		$stmt->execute();
    		return $stmt->fetchAll(PDO::FETCH_ASSOC);
    	}
    
    	public function deleteSite($id) {
    		$stmt = $this->con->prepare("DELETE FROM fx_sites WHERE id=:id LIMIT 1");
    		$stmt->bindParam(":id", $id);
    		$stmt->execute();
    	}
    
    	public function setActive($id, $active) {
    		$stmt = $this->con->prepare("UPDATE fx_sites SET active=:active WHERE id=:id LIMIT 1");
    		$stmt->bindParam(":id", $id);
    		$stmt->bindParam(":active", $active);
    		$stmt->execute();
    	}
    
    	public function addSite($data) {
    		$stmt = $this->con->prepare("INSERT INTO fx_sites (title, url, site_id) VALUES (:title, :url, :site_id)");
    		foreach ($data as $key => $value) {
    			$stmt->bindParam($key, $value);
    		}
    		$stmt->execute();
    	}
    
    	public function startVote($siteId, $username, $ip, $uid) {
    		$stmt = $this->con->prepare("INSERT INTO fx_votes (username, site_id, ip_address, uid) VALUES (:user, :sid, :addr, :uid)");
    		$stmt->bindParam(":user", $username);
    		$stmt->bindParam(":sid", $siteId);
    		$stmt->bindParam(":addr", $ip);
    		$stmt->bindParam(":uid", $uid);
    		$stmt->execute();
    	}
    
    	public function getMostRecentVote($siteId, $username, $addr) {
    		$stmt = $this->con->prepare("SELECT * FROM fx_votes WHERE site_id=:sid AND (username=:user OR ip_address=:addr) AND started > DATE_SUB(now(), INTERVAL 12 HOUR) AND callback_date IS NULL ORDER BY started DESC LIMIT 1");
    		$stmt->bindParam(":user", $username);
    		$stmt->bindParam(":sid", $siteId);
    		$stmt->bindParam(":addr", $addr);
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function getVote($siteId, $username, $addr) {
    		$stmt = $this->con->prepare("SELECT * FROM fx_votes WHERE site_id=:sid AND username=:user AND callback_date > DATE_SUB(now(), INTERVAL 12 HOUR) AND callback_date IS NOT NULL");
    		$stmt->bindParam(":user", $username);
    		$stmt->bindParam(":sid", $siteId);
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function getVotesById($siteId) {
    		$stmt = $this->con->prepare("SELECT COUNT(*) FROM fx_votes WHERE site_id=:sid AND callback_date IS NOT NULL");
    		$stmt->bindParam(":sid", $siteId);
    		$stmt->execute();
    		return $stmt->fetchColumn();
    	}
    
    	public function getVoteByUid($uid) {
    		$stmt = $this->con->prepare("SELECT * FROM fx_votes WHERE uid=:uid");
    		$stmt->bindParam(":uid", $uid);
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function insertVote($uid) {
    		$stmt = $this->con->prepare("UPDATE fx_votes SET callback_date = NOW() WHERE uid=:uid AND started > DATE_SUB(now(), INTERVAL 12 HOUR) AND callback_date IS NULL");
    		$stmt->bindParam(":uid", $uid);
    		$stmt->execute();
    	}
    
    	public function getVotm() {
    		$stmt = $this->con->prepare("SELECT COUNT(*) AS votes,username FROM fx_votes WHERE YEAR(callback_date) = YEAR(CURDATE()) AND MONTH(callback_date) = MONTH(CURDATE()) GROUP BY username ORDER BY votes DESC LIMIT 5");
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function getVotes() {
    		$stmt = $this->con->prepare("SELECT COUNT(*) AS votes FROM fx_votes WHERE YEAR(callback_date) = YEAR(CURDATE()) AND MONTH(callback_date) = MONTH(CURDATE()) ORDER BY votes DESC LIMIT 5");
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function updateSite($id, $title, $voteId, $url) {
    		$stmt = $this->con->prepare("UPDATE fx_sites SET title=:title, url=:url, site_id=:sid WHERE id=:id");
    		$stmt->execute(array(
    			"title" => $title,
    			"url" => $url,
    			"sid" => $voteId,
    			"id" => $id
    		));
    	}
    
    	public function insert($table, $vars) {
            $keys = array_keys($vars);
            $query = "INSERT INTO $table (";
            for ($i = 0; $i < count($keys); $i++) {
                $query .= ''.$keys[$i].($i < count($keys) - 1 ? ", " : ") VALUES (");
            }
            for ($i = 0; $i < count($keys); $i++) {
                $query .= ':'.$keys[$i].($i < count($keys) - 1 ? ", " : ")");
            }
            $stmt = $this->con->prepare($query);
            $stmt->execute($vars);
        }
    
        public function update($table, $key, $vars) {
        	$keys = array_keys($vars);
        	$query = "UPDATE $table SET ";
        	for ($i = 0; $i < count($keys); $i++) {
        		 $query .= "".$keys[$i]."=:".$keys[$i]."".($i < count($keys) - 1 ? ", " : " WHERE id=$key");
        	}
        	$stmt = $this->con->prepare($query);
            $stmt->execute($vars);
        }
    }
    ?>
    bump still need help not sure what to put because i already added the mysql in the constants file
    Reply With Quote  
     

  4. #4  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    Quote Originally Posted by kelaby View Post
    Code:
    Code:
    <?php
    class Database {
    
    	private $con;
    
    	private $host;
    	private $user;
    	private $pass;
    	private $data;
    
    	public function __construct($host, $user, $pass, $data) {
    		$this->host = $host;
    		$this->user = $user;
    		$this->pass = $pass;
    		$this->data = $data;
    	}
    
    	public function connect() {
    		try {
    			$this->con = new PDO('mysql:host='.$this->host.';dbname='.$this->data.';charset=utf8', $this->user, $this->pass);
    			$this->con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    			$this->con->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
    			return true;
    		} catch (Exception $e) {
    			echo 'Unable to connect to database. Please check credentials and try again.';
    			return false;
    		}
    	}
    
    	public function getSites() {
    		$stmt = $this->con->prepare("SELECT * FROM fx_sites WHERE active=1");
    		$stmt->execute();
    		return $stmt->fetchAll(PDO::FETCH_ASSOC);
    	}
    
    	public function getAllSites() {
    		$stmt = $this->con->prepare("SELECT * FROM fx_sites");
    		$stmt->execute();
    		return $stmt->fetchAll(PDO::FETCH_ASSOC);
    	}
    
    	public function getSite($value) {
    		$stmt = $this->con->prepare("SELECT * FROM fx_sites WHERE id=:value LIMIT 1");
    		$stmt->bindParam(":value", $value);
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function getSiteByIp($value) {
    		$stmt = $this->con->prepare("SELECT * FROM fx_sites WHERE ip_address=:value LIMIT 1");
    		$stmt->bindParam(":value", $value);
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function getSiteBy($column, $value) {
    		$stmt = $this->con->prepare("SELECT * FROM fx_sites WHERE $column=:value LIMIT 1");
    		$stmt->bindParam(":value", $value);
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function getVoteStats() {
    		$stmt = $this->con->prepare("SELECT COUNT(*) AS amount, MONTH(callback_date) AS month FROM fx_votes WHERE callback_date IS NOT NULL AND YEAR(callback_date) = YEAR(CURDATE()) GROUP BY month ORDER BY month ASC");
    		$stmt->execute();
    		return $stmt->fetchAll(PDO::FETCH_ASSOC);
    	}
    
    	public function deleteSite($id) {
    		$stmt = $this->con->prepare("DELETE FROM fx_sites WHERE id=:id LIMIT 1");
    		$stmt->bindParam(":id", $id);
    		$stmt->execute();
    	}
    
    	public function setActive($id, $active) {
    		$stmt = $this->con->prepare("UPDATE fx_sites SET active=:active WHERE id=:id LIMIT 1");
    		$stmt->bindParam(":id", $id);
    		$stmt->bindParam(":active", $active);
    		$stmt->execute();
    	}
    
    	public function addSite($data) {
    		$stmt = $this->con->prepare("INSERT INTO fx_sites (title, url, site_id) VALUES (:title, :url, :site_id)");
    		foreach ($data as $key => $value) {
    			$stmt->bindParam($key, $value);
    		}
    		$stmt->execute();
    	}
    
    	public function startVote($siteId, $username, $ip, $uid) {
    		$stmt = $this->con->prepare("INSERT INTO fx_votes (username, site_id, ip_address, uid) VALUES (:user, :sid, :addr, :uid)");
    		$stmt->bindParam(":user", $username);
    		$stmt->bindParam(":sid", $siteId);
    		$stmt->bindParam(":addr", $ip);
    		$stmt->bindParam(":uid", $uid);
    		$stmt->execute();
    	}
    
    	public function getMostRecentVote($siteId, $username, $addr) {
    		$stmt = $this->con->prepare("SELECT * FROM fx_votes WHERE site_id=:sid AND (username=:user OR ip_address=:addr) AND started > DATE_SUB(now(), INTERVAL 12 HOUR) AND callback_date IS NULL ORDER BY started DESC LIMIT 1");
    		$stmt->bindParam(":user", $username);
    		$stmt->bindParam(":sid", $siteId);
    		$stmt->bindParam(":addr", $addr);
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function getVote($siteId, $username, $addr) {
    		$stmt = $this->con->prepare("SELECT * FROM fx_votes WHERE site_id=:sid AND username=:user AND callback_date > DATE_SUB(now(), INTERVAL 12 HOUR) AND callback_date IS NOT NULL");
    		$stmt->bindParam(":user", $username);
    		$stmt->bindParam(":sid", $siteId);
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function getVotesById($siteId) {
    		$stmt = $this->con->prepare("SELECT COUNT(*) FROM fx_votes WHERE site_id=:sid AND callback_date IS NOT NULL");
    		$stmt->bindParam(":sid", $siteId);
    		$stmt->execute();
    		return $stmt->fetchColumn();
    	}
    
    	public function getVoteByUid($uid) {
    		$stmt = $this->con->prepare("SELECT * FROM fx_votes WHERE uid=:uid");
    		$stmt->bindParam(":uid", $uid);
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function insertVote($uid) {
    		$stmt = $this->con->prepare("UPDATE fx_votes SET callback_date = NOW() WHERE uid=:uid AND started > DATE_SUB(now(), INTERVAL 12 HOUR) AND callback_date IS NULL");
    		$stmt->bindParam(":uid", $uid);
    		$stmt->execute();
    	}
    
    	public function getVotm() {
    		$stmt = $this->con->prepare("SELECT COUNT(*) AS votes,username FROM fx_votes WHERE YEAR(callback_date) = YEAR(CURDATE()) AND MONTH(callback_date) = MONTH(CURDATE()) GROUP BY username ORDER BY votes DESC LIMIT 5");
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function getVotes() {
    		$stmt = $this->con->prepare("SELECT COUNT(*) AS votes FROM fx_votes WHERE YEAR(callback_date) = YEAR(CURDATE()) AND MONTH(callback_date) = MONTH(CURDATE()) ORDER BY votes DESC LIMIT 5");
    		$stmt->execute();
    		return $stmt->fetch(PDO::FETCH_ASSOC);
    	}
    
    	public function updateSite($id, $title, $voteId, $url) {
    		$stmt = $this->con->prepare("UPDATE fx_sites SET title=:title, url=:url, site_id=:sid WHERE id=:id");
    		$stmt->execute(array(
    			"title" => $title,
    			"url" => $url,
    			"sid" => $voteId,
    			"id" => $id
    		));
    	}
    
    	public function insert($table, $vars) {
            $keys = array_keys($vars);
            $query = "INSERT INTO $table (";
            for ($i = 0; $i < count($keys); $i++) {
                $query .= ''.$keys[$i].($i < count($keys) - 1 ? ", " : ") VALUES (");
            }
            for ($i = 0; $i < count($keys); $i++) {
                $query .= ':'.$keys[$i].($i < count($keys) - 1 ? ", " : ")");
            }
            $stmt = $this->con->prepare($query);
            $stmt->execute($vars);
        }
    
        public function update($table, $key, $vars) {
        	$keys = array_keys($vars);
        	$query = "UPDATE $table SET ";
        	for ($i = 0; $i < count($keys); $i++) {
        		 $query .= "".$keys[$i]."=:".$keys[$i]."".($i < count($keys) - 1 ? ", " : " WHERE id=$key");
        	}
        	$stmt = $this->con->prepare($query);
            $stmt->execute($vars);
        }
    }
    ?>
    bump still need help not sure what to put because i already added the mysql in the constants file
    Your mysql database need to have a table called 'fx_votes' with the row name's 'id', 'username', 'callback_date', 'started', 'ip_address', 'site_id', 'uid', 'claimed'...etc till you fullfilled all proposed values in this code.
    What each value should be, you'll have to look into the code. I am surprised this was not included in your sql if you followed a tutorial about it.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  5. Thankful user:


  6. #5  
    Registered Member
    Join Date
    Sep 2011
    Posts
    22
    Thanks given
    9
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by arch337 View Post
    Your mysql database need to have a table called 'fx_votes' with the row name's 'id', 'username', 'callback_date', 'started', 'ip_address', 'site_id', 'uid', 'claimed'...etc till you fullfilled all proposed values in this code.
    What each value should be, you'll have to look into the code. I am surprised this was not included in your sql if you followed a tutorial about it.
    would of been great if there was an sql with the files that were sent to me or a guide to show me what to do in steps however the files with the donation and highscores websided had a guide and the sql which made it so easy to do only the vote one is becoming difficult to do
    Reply With Quote  
     

  7. #6  
    BoomScape #1
    BoomScape's Avatar
    Join Date
    May 2013
    Posts
    2,422
    Thanks given
    289
    Thanks received
    234
    Rep Power
    48
    Quote Originally Posted by kelaby View Post
    would of been great if there was an sql with the files that were sent to me or a guide to show me what to do in steps however the files with the donation and highscores websided had a guide and the sql which made it so easy to do only the vote one is becoming difficult to do
    You are using the norse web files as far as I can see, so I assume you didn't purchase the voting script from kingfox where you would have received the correct sql files, you can easily just make the sql database though \_o_/
    Attached image
    Reply With Quote  
     

  8. #7  
    Registered Member
    Join Date
    Sep 2011
    Posts
    22
    Thanks given
    9
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by BoomScape View Post
    You are using the norse web files as far as I can see, so I assume you didn't purchase the voting script from kingfox where you would have received the correct sql files, you can easily just make the sql database though \_o_/
    not sure how to make it but I sent you a pm if you are able to help thanks
    Reply With Quote  
     

  9. #8  
    Registered Member
    Join Date
    Sep 2011
    Posts
    22
    Thanks given
    9
    Thanks received
    0
    Rep Power
    11
    bump still require more help if anyone has the time. God bless
    Reply With Quote  
     

  10. #9  
    Registered Member
    Optimum's Avatar
    Join Date
    Apr 2012
    Posts
    3,570
    Thanks given
    871
    Thanks received
    1,745
    Rep Power
    5000
    Quote Originally Posted by arch337 View Post
    Your mysql database need to have a table called 'fx_votes' with the row name's 'id', 'username', 'callback_date', 'started', 'ip_address', 'site_id', 'uid', 'claimed'...etc till you fullfilled all proposed values in this code.
    What each value should be, you'll have to look into the code. I am surprised this was not included in your sql if you followed a tutorial about it.
    @kelaby the guy told you exactly what’s wrong and you’re still asking for help
    Literally google how to create an sql table
    CREATE THE DAM SQL TABLE

    Quote Originally Posted by DownGrade View Post
    Don't let these no life creeps get to you, its always the same on here. They'd rather spend hours upon hours in the rune-server spam section then getting laid! ha ha!Its honestly pathetic i haven't seen so many lowlifes in my life its actually insane i wish that this section would just vanish its probably the only way to get these people out of the community...
    PLEASE BE AWARE OF IMPOSTERS MY DISCORD ID: 362240000760348683
    Reply With Quote  
     

  11. #10  
    Registered Member
    Join Date
    Sep 2011
    Posts
    22
    Thanks given
    9
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Optimum View Post
    @kelaby the guy told you exactly what’s wrong and you’re still asking for help
    Literally google how to create an sql table
    CREATE THE DAM SQL TABLE
    easy said than done I've actually took your advice and google that and its not as simple as that, because there are tons of sql and its not leading to the one that is needed for the mysql database table etc
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. Stuck while setting up GTL Vote Script v1.1
    By Black Widow in forum Help
    Replies: 2
    Last Post: 07-25-2015, 06:58 PM
  2. Paint VS Photoshop, Vote Please!!!
    By Karlis in forum General
    Replies: 22
    Last Post: 11-04-2007, 07:40 PM
  3. Sotw 1 Voting
    By Stuie in forum General
    Replies: 28
    Last Post: 06-14-2007, 12:19 AM
  4. Vote your favorite....
    By Aces in forum Showcase
    Replies: 0
    Last Post: 04-02-2007, 03:00 AM
  5. Replies: 0
    Last Post: 12-26-2006, 06:36 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
  •