Jump to content

Recommended Posts

I have an private server.I am making an vote script so if you vote for my private server it adds one point.The script works but it doesn't show in game.I think it doesn't show in game because the column that script edits is an int value.I think it updates it as a text value so it doesn't works.Can you recommend me anything.Please help me.I will appreciate all answers.

 

<?php
mysql_connect("localhost", "root", "your_password");
mysql_select_db("db_game");
 
$timeout=60*60*12;
$time=time(); 
$out=$time-$timeout;
$username=$_POST['username'];
 
$points1=mysql_query("SELECT pvpscore FROM t_user WHERE name='$username'");
while($row = mysql_fetch_array( $points1 )) {
$points=$row['pvpscore']+1;}
 
$check_double=mysql_query("SELECT * FROM t_account WHERE name='$username' AND time>$out")or die(mysql_error());
if(mysql_num_rows($check_double)>0){ 
echo "You already voted. You can vote each 12 hours"; 
}
else{ 
header("location:Vote Link");
$vote=mysql_query("UPDATE t_user SET time='$time', pvpscore='$points' WHERE name='$username'");}
?>
Note:Time is a text field and pvpscore is a int(11) field.
Edited by Waleed2
Link to comment
https://forums.phpfreaks.com/topic/275537-help-with-vote-script/
Share on other sites

You're saying your time column is a text field, but it should really be an int since you're using it like this in your query:

$check_double=mysql_query("SELECT * FROM t_account WHERE name='$username' AND time>$out")or die(mysql_error());

See the bold? You're trying to ask "Is this text larger than this int"

 

So try set the text column in the database to int and see if that solves your problem!

 

..and just like DaveyK said, remove the header("location:Vote Link");

or at least move it.

 

- W

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.