Jump to content


Photo

[solved] problam with time()


  • Please log in to reply
7 replies to this topic

#1 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 05 August 2006 - 10:00 PM

for some unknown reason the if statement gives a error please advise me cheers.



<?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";
}

?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#2 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 05 August 2006 - 10:03 PM

What error does it give you?

#3 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 05 August 2006 - 10:05 PM

Also, I think you want to do $time_know < $time_added , that way it will be a two minute wait after whatever is added?

#4 ronverdonk

ronverdonk
  • Members
  • PipPipPip
  • Advanced Member
  • 277 posts
  • LocationNetherlands

Posted 05 August 2006 - 10:06 PM

You only have 1 close-accolade and 2 start-accolades (while and if)

RTFM is an almost extinct art form, it should be subsidized.

#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 05 August 2006 - 11:37 PM

$time_know=(time()+120);

can you tell me if this is the correct way to add 120 secons

database result


1154863305// 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.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 06 August 2006 - 12:18 AM

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.


$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;

}


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#7 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 06 August 2006 - 06:23 AM

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.

<?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;

}
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#8 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 06 August 2006 - 07:43 AM

solved



<?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;

}

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users