cobracommander Posted May 22, 2012 Share Posted May 22, 2012 Hello Everyone, I am trying to accomplished this first. I have php file.. where visitors comes and i track there ip and current visit time... and push that into database mysql under logs table -- > time and ip coloumn also with this. I place counters = 2. in counters table in there.. $sql="DELETE FROM logs WHERE counters='2'&& (. (time() - 60) . ' >= `time`')"; $result=mysql_query($sql); if successfully deleted if($result){ echo "Deleted Successfully"; echo "<BR>"; In above code. I want to match two conditions if counters =2 met and if current time subtract 60 seconds and if that is equal or greater then the time in database. it should delete other wise not... well if i remove after && (. (time() - 60) . ' >= `time`') then it works only matching counters or if i delete counters it works. so where i am stuck.. can any1 really help me Quote Link to comment Share on other sites More sharing options...
Maq Posted May 22, 2012 Share Posted May 22, 2012 Do you get any errors? Add this: $result=mysql_query($sql) or die(mysql_error()); Echo out your query. Quote Link to comment Share on other sites More sharing options...
awjudd Posted May 23, 2012 Share Posted May 23, 2012 You are mixing PHP and your query without actually swapping. $sql="DELETE FROM logs WHERE counters=2 AND " . (time() - 60) . " >= `time`"; ~awjudd 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.