<?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!");
}
}
?>
它不更新與votingpoints數據庫和lastvotetime 但它傳遞的第一次檢查(這意味着它發現在數據庫中的客戶記錄),但它不」簡單的PHP投票系統沒有更新數據庫
$query = mysql_query("update entities set VotsPoints = '$votingpoints', LastVoteTime = '$lastvote' WHERE Name = '". $InGameName ."'");
您使用「設置」多次,不知道這是OK:T將它們在代碼 感謝提前結束
MySQL是depriciated ...轉移到PDO或mysqli的,請 – 2013-02-09 23:29:51
謝謝你,但不會修復此代碼,我需要做的這個頁面儘快 – AndrewxXx 2013-02-09 23:31:15
MySQL是不會被棄用。從PHP v5.5(目前僅在alpha版本中)開始,PHP擴展'ext/mysql'提供了前綴爲'mysql_'的所有函數。 – eggyal 2013-02-09 23:31:40