1
<?php
session_start();
$host        =    'localhost';
$user        =    'root';
$password    =    '8******8';
$database    =    'tg*****ba';

$conn = mysql_connect($host,$user,$password) or 
  die('Server Information is not Correct'); 

//Establish Connection with Server
mysql_select_db($database,$conn) or die('Database Information is not correct');
$InGameName    =    mysql_real_escape_string($_POST['InGameName']);
$LastVoteTime;

//===When I will Set the Button to 1 or Press Button to register
if(isset($_POST['btnVote'])) 
{
  if(md5($_POST['code']) != $_SESSION['key']) 
    die("You've entered a wrong code!");
  $query = mysql_query("SELECT * FROM entities WHERE Name = '". $InGameName ."'"); 
  if (mysql_num_rows($query) < 0) 
  { 
     die("This In game name doesn't exist , please enter your account name not username!");
  }
  else
  {
    $date = date('YmdHis');
    $row=mysql_fetch_object($query);
    $lastvote=$row->LastVoteTime;
    $votingpoints = $row->VotsPoints;
    $url = "http://www.xtremetop100.com/in.php?site=***********";

    if(($lastvote + 120000) < $date)
    {
      $lastvote = $date;
      $votingpoints += 1;
      $query = mysql_query("update entities set VotsPoints ='$votingpoints' set LastVoteTime ='$lastvote' WHERE Name = '". $InGameName ."'"); 
    }
    else
      die("You've Already voted in the last 12 hrs!");
  }
}

?>

它不会使用投票点和 lastvotetime 更新数据库,但是它通过了第一次检查(这意味着它在数据库中找到了帐户记录),但它没有在该代码的末尾设置它们提前谢谢

4

2 回答 2

2

尝试:

$query = mysql_query("update entities set VotsPoints = '$votingpoints', LastVoteTime = '$lastvote' WHERE Name = '". $InGameName ."'");

您多次使用“set”,不确定是否可以。

于 2013-02-09T23:34:15.000 回答
0

UPDATE 语句中的 SQL 语法不正确。 http://dev.mysql.com/doc/refman/5.0/en/update.html

于 2013-02-09T23:59:15.480 回答