redarrow Posted August 5, 2006 Share Posted August 5, 2006 for some unknown reason the if statement gives a error please advise me cheers.[code]<?php$query_time="select * from member_comments where date_added='".$record['date_added']."' and time_added='".$record['time_added']."' ";$result_time=mysql_query($query_time);while($timmed=mysql_fetch_assoc($result_time)){$time_added=$timmed['time_added'];$time_added=strtotime($time_added);$time_know=(time()+120);if($time_know > $time_added){echo " sorry wait 2 minutes please";}?>[/code] Quote Link to comment Share on other sites More sharing options...
hostfreak Posted August 5, 2006 Share Posted August 5, 2006 What error does it give you? Quote Link to comment Share on other sites More sharing options...
hostfreak Posted August 5, 2006 Share Posted August 5, 2006 Also, I think you want to do $time_know < $time_added , that way it will be a two minute wait after whatever is added? Quote Link to comment Share on other sites More sharing options...
ronverdonk Posted August 5, 2006 Share Posted August 5, 2006 You only have 1 close-accolade and 2 start-accolades (while and if) Quote Link to comment Share on other sites More sharing options...
redarrow Posted August 5, 2006 Author Share Posted August 5, 2006 $time_know=(time()+120);can you tell me if this is the correct way to add 120 seconsdatabase result1154863305// from the database as a posted entry.1154821215// time from time now.looks very lomg and wrong to me there should only be 2 minutes between them both please help. Quote Link to comment Share on other sites More sharing options...
redarrow Posted August 6, 2006 Author Share Posted August 6, 2006 for some strange reason i am always getting the echoed message so i think i proberly not doing this correct i am trying to create a flood controll but not working becouse the word is always echoed.[code]$query_time="select * from member_comments WHERE time_added='$time_added' and date_added='$date_added' and user_id='$user_id' ";echo $query_time;$result_time=mysql_query($query_time);while($timmed=mysql_fetch_assoc($result_time)){$time_check=$timmed['time_sent'];}$check=strtotime($time_check);echo "<br>$check<BR>";$time_know=time() + 120;echo "<br>$time_know<br>";if($time_know > $check){echo " sorry wait 2 minutes please";exit;}[/code] Quote Link to comment Share on other sites More sharing options...
redarrow Posted August 6, 2006 Author Share Posted August 6, 2006 What am i doing wrong please been up all night read the hole php for dumies no luck.the database is correct and all the settings are correct but the time diffrence does not seem to work please help cheers.all i get is the echoed message as below cheers.[code]<?php$query_time="select * from member_comments WHERE time_added='$time_added' and date_added='$date_added' and user_id='$user_id' ";echo $query_time;$result_time=mysql_query($query_time);while($timmed=mysql_fetch_assoc($result_time)){$time_check=$timmed['time_sent'];}$check=strtotime($time_check);echo "<br>$check<BR>";$time_know=time() + 120;echo "<br>$time_know<br>";if($check < $time_know){echo " sorry wait 2 minutes please";exit;}?>[/code] Quote Link to comment Share on other sites More sharing options...
redarrow Posted August 6, 2006 Author Share Posted August 6, 2006 solved [code]<?php$query_time="select * from member_comments WHERE time_added='$time_added' and date_added='$date_added' and user_id='$user_id' ";echo $query_time;$result_time=mysql_query($query_time);while($timmed=mysql_fetch_assoc($result_time)){$time_check=$timmed['time_sent'];}$check=strtotime($time_check);echo "<br>$check<BR>";$time_know=time()-60;echo "<br>$time_know<br>";if($check > $time_know){echo " sorry wait 2 minutes please";exit;}[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.