Clicking on a button for limited times

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
egturnkey
Forum Commoner
Posts: 34
Joined: Sun Jul 26, 2009 7:35 pm

Clicking on a button for limited times

Post by egturnkey »

Hello dear friends ,

Consider we have a button where you should click

Is there anyone can help me and give the best idea how to make it limited

i means after 20 clicking on that button , it goes de-active / or / image / or / text for example says ( no more clicking )


Yes it could be very complex idea cause it may needs to recall a command at cronjob ( if i'm not wrong )



So the full story :-

i want a button that valid to be clicked 20 times per 24 hours , after the clicking 20 times , it gives msg says for example " come back 2morrow "


thanks in advance and i know it maybe hard and may takes time
but i really with that help , will open a new area into my mind



okay here is an simple example of


database.sql ( ip / time )
config.php ( connection to database )
index.php ( main functions )


download
---------

http://www.egcss.com/example.rar


but it didn't works cause i've still some error and really not able to understand where to put thay query

Code: Select all

$time = time();  
mysql_query("INSERT INTO `ip_table` (`ip`,`timestamp`) VALUES ('".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."',$time)");  
 
so can you please check out the example and fix it
egturnkey
Forum Commoner
Posts: 34
Joined: Sun Jul 26, 2009 7:35 pm

Re: Clicking on a button for limited times

Post by egturnkey »

any help to fix that code
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Clicking on a button for limited times

Post by pickle »

Store the query in a variable first, then output that variable. Run the query on the command line to tweak it.

You can also add:

Code: Select all

or die(mysql_error());
to your query code to see exactly what the error is.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply