Nicholas Posted August 6, 2009 Posted August 6, 2009 hi, im kinda confused, can anyone help me on how to fill this in please? <?php session_start(); //Include your mysql connection here //your database variables $playertable = "users"; $rewardtype = "money"; $reward = "100"; ///////////////////////// $userid = mysql_real_escape_string($_POST['user']); $userinfo=mysql_query("SELECT * FROM $playertable WHERE userid=$userid",$c) or die(mysql_error()); if(!mysql_num_rows($userinfo)) { exit; } $q=mysql_query("SELECT * FROM votes WHERE userid=$userid AND list='GB'",$c); if(mysql_num_rows($q)) { } else { mysql_query("INSERT INTO votes values ($userid,'GB')",$c); mysql_query("UPDATE $playertable SET $rewardtype=$rewardtype+$reward WHERE userid=$userid",$c); } ?> i got this code from a voting site called Gamingbytes, and im wondering how do i fill it in and what should i call the file? can anyone help me please? Quote
Magictallguy Posted August 7, 2009 Posted August 7, 2009 Re: can anyone help me on this please? include(DIRNAME(__FILE__) . '/globals.php'); Presuming you're using v2. Quote
POG1 Posted August 7, 2009 Posted August 7, 2009 Re: can anyone help me on this please? You will want just the connection. Add this code: include_once("config.php"); include_once("class/class_db_".$_CONFIG['driver'].".php"); $db = new database; $db->configure($_CONFIG['hostname'],$_CONFIG['username'],$_CONFIG['password'],$_CONFIG['database'],$_CONFIG['persistent']); $db->connect(); Quote
Nicholas Posted August 7, 2009 Author Posted August 7, 2009 Re: can anyone help me on this please? so like this? and it should work and give out a reward for voting? <?php session_start(); include_once("config.php"); include_once("class/class_db_".$_CONFIG['driver'].".php"); $db = new database; $db->configure($_CONFIG['hostname'],$_CONFIG['username'],$_CONFIG['password'],$_CONFIG['database'],$_CONFIG['persistent']); $db->connect(); $playertable = "users"; $rewardtype = "money"; $reward = "100"; ///////////////////////// $userid = mysql_real_escape_string($_POST['user']); $userinfo=mysql_query("SELECT * FROM $playertable WHERE userid=$userid",$c) or die(mysql_error()); if(!mysql_num_rows($userinfo)) { exit; } $q=mysql_query("SELECT * FROM votes WHERE userid=$userid AND list='GB'",$c); if(mysql_num_rows($q)) { } else { mysql_query("INSERT INTO votes values ($userid,'GB')",$c); mysql_query("UPDATE $playertable SET $rewardtype=$rewardtype+$reward WHERE userid=$userid",$c); } ?> and yes i am using v2 Quote
Haunted Dawg Posted August 7, 2009 Posted August 7, 2009 Re: can anyone help me on this please? Is this for incentive voting? Quote
Nicholas Posted August 7, 2009 Author Posted August 7, 2009 Re: can anyone help me on this please? whats "incentive" voting mean? but this is for voting, yes. Quote
Nicholas Posted August 7, 2009 Author Posted August 7, 2009 Re: can anyone help me on this please? oh found out what u mean! yes its for incentive voting. why? Quote
Haunted Dawg Posted August 8, 2009 Posted August 8, 2009 Re: can anyone help me on this please? Then the script you provided won't work. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.