Jump to content
MakeWebGames

Voted Today?


gurpreet

Recommended Posts

Re: Voted Today?

I did that on my game the easiest way I found to do it was add add another field in the users table called voted or something and then when they click the vote link it updates that field +1 and then depending on how many vote links you have ... in your header you could do something link

 

if ($ir['voted'] < 5)
{
echo ' Have you voted today?? ';
} 

 

That should work for what your wanting. Then in your day cron just make it trunicate (empty) the "voted" field so that it does that same thing the next day.

Link to comment
Share on other sites

Re: Voted Today?

 

lol hell I dunno, thats way over my skills of programming as of yet lol. I am still wanting to learn the whole sprintf part. Once I do that I am going to go sprintf crazy on this damn messy v2 script lol. Took a look at it over at the normal learnin place but was too tired at the time to take it in and learn it.

lol thats funny right there.

without sprintf would be this...

 

$vote = $db->query("SELECT list FROM votes WHERE userid = ".$ir['userid']." ");

if(mysql_num_rows($vote) >2)//Change the 2 to however many there are.
{
echo "some message";
}

 

what im not sure is goin to work is the query itself, it might nix up the userid

Link to comment
Share on other sites

Re: Voted Today?

ahhh now thats more like it lol.

looks like it would work.... I didn't think of doing it that way ( 1000 watt light bulb flashes on )

I just might try that and see if I can get it to work. And I will conquor that damn sprintf one of these days, I know its better I just don't know the pros and cons of it quite yet. I have had my nose stuck in these damn templates for too long lol its about time to get my head out of the sand and get back to learning other things.

Link to comment
Share on other sites

Re: Voted Today?

 

lol hell I dunno, thats way over my skills of programming as of yet lol. I am still wanting to learn the whole sprintf part. Once I do that I am going to go sprintf crazy on this damn messy v2 script lol. Took a look at it over at the normal learnin place but was too tired at the time to take it in and learn it.

lol thats funny right there.

without sprintf would be this...

 

$vote = $db->query("SELECT list FROM votes WHERE userid = ".$ir['userid']." ");

if(mysql_num_rows($vote) >2)//Change the 2 to however many there are.
{
echo "some message";
}

 

what im not sure is goin to work is the query itself, it might nix up the userid

So would this work? and i think i put in the header, right?

Link to comment
Share on other sites

Re: Voted Today?

 

$votes = sprintf("SELECT list FROM votes WHERE userid = '%u' ",
   ($ir['userid']));
       $vote = mysql_query($votes);

if(mysql_num_rows($vote) >2)//Change the 2 to however many there are.
{
echo "some message";
}

 

with the >2 what does that mean? number of vote sites?

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