buladex Posted April 29, 2010 Share Posted April 29, 2010 $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1) { [color=red] $sql="SELECT * FROM $tbl_name WHERE DATE_ADD`last_voted` (INTERVAL 12 HOUR) < NOW() and username='$myusername'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1)[/color] { // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:login_success.php"); mysql_query("UPDATE $tbl_name SET `vote_credits` = `vote_credits`+1 WHERE username='$myusername'"); mysql_query("UPDATE $tbl_name SET `last_voted` = NOW() WHERE username='$myusername'"); mysql_close($myconn); } else { echo "12h"; } } else { echo "Wrong Username or Password"; } its a script that allowes ppl to vote on a 12 h interval, but i have a probleam it doesnt work, i think problem is where i write in red Link to comment https://forums.phpfreaks.com/topic/200150-need-hel-whit-this-please/ Share on other sites More sharing options...
cags Posted April 29, 2010 Share Posted April 29, 2010 Try rewriting the query like this, your syntax doesn't seem quite right... SELECT * FROM $tbl_name WHERE DATE_ADD(`last_voted`, INTERVAL 12 HOUR) < NOW() and username='$myusername'" Link to comment https://forums.phpfreaks.com/topic/200150-need-hel-whit-this-please/#findComment-1050466 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.