Jump to content
MakeWebGames

Voting Query error


Shakeynath

Recommended Posts

i think i know whats going on?

Query was SELECT * FROM votes WHERE userid=2 AND list='2'

shouldnt the query be sending the information in like this

Query was SELECT * FROM votes WHERE userid=2 AND list='awg'

(awg is Apex Web Gaming)

to put it in the database like this...

userid | list

2 | awg

with the votes database like this

 

CREATE TABLE IF NOT EXISTS `votes` (
 `userid` int(11) NOT NULL default '0',
 `list` varchar(255) collate latin1_general_ci NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

 

this is my voting file...

 

<?php
session_start();
if(get_magic_quotes_gpc() == 0)
{
foreach($_POST as $k => $v)
{
 $_POST[$k]=addslashes($v);
}
foreach($_GET as $k => $v)
{
 $_GET[$k]=addslashes($v);
}
}
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
$_CONFIG['username'],
$_CONFIG['password'],
$_CONFIG['database'],
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$is=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid");
$ir=$db->fetch_row($is);
$q=$db->query("SELECT * FROM votes WHERE userid=$userid AND list='awg'");
if($db->num_rows($q))
{

print "You have already voted at Apex Web Gaming today!";

}
else
{
$db->query("INSERT INTO votes values ($userid,'awg')");
$db->query("UPDATE users SET crystals=crystals+10, money=money+250 WHERE userid=$userid");
header("Location:http://apexwebgaming.com/in/4352");
exit;
}
?>

 

this is the voting file where the players get the information from for voting?

as you can see there is 2 awg's, i think the first awg is line

$q=$db->query("SELECT * FROM votes WHERE userid=$userid AND list='awg'");

and maybe yours is set up like...

$q=$db->query("SELECT * FROM votes WHERE userid=$userid AND list='2");

and maybe line

$db->query("INSERT INTO votes values ($userid,'awg')");

has the letters or number where the awg is and its typed in differently, both the awg's have to typed in the same on both lines?

if you know what i mean lol

hopefully ive not said it in a confusing way...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...