Angela,

the variable $current_page does not exist. so $curent_page does not equal
$saved_page.  Also the ! in front of the entire statement means that all of
this is false.  Since one items is true and not true = false "Don't save"
is echoed out.

If you are looking to save the results based on the above sample it would
look like


if(($page === $saved_page) && ($current_ip === $saved_ip) && ($current_dt <
($saved_dt +3600)) {
 //save the results
} else {
//don't save
}

I would also suggest keeping with your original statement to return early
and return often. Its best to exit out of your functions sooner than later.
 Specially if its a large function.


On Mon, Mar 11, 2013 at 6:03 PM, Angela Barone
<ang...@italian-getaways.com>wrote:

> On Mar 11, 2013, at 3:47 PM, Ashley Sheridan wrote:
> > if ( !( ($current_page == $saved_page) and ($current_ip == $saved_ip)
> and ($current_dt < ($saved_dt + 3600)) ) )
>
> Hello Ash,
>
>         This makes sense to me, but I can't get it to work, so I'm either
> not understanding it or I'm asking the wrong question.  Here's a complete
> scriptlet:
>
> <?php
> $saved_page = 'ddd';
> $page       = 'ddd';
> $saved_ip   = '1.1.1.1';
> $ip         = '1.1.1.1';
> $saved_dt   = '2013-03-11 11:11:11';
> $current_dt = '2013-03-11 11:22:11';
>
> if ( !( ($current_page == $saved_page) and ($current_ip == $saved_ip) and
> ($current_dt < ($saved_dt + 3600)) ) ) {
>         echo 'Save results.';
> } else {
>         echo "Don't save.";
> }
> ?>
>
>         Using the supplied data, the result should be "Don't save."  Can
> you see what's wrong?
>
> Angela
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to