Re: UNLESS Statement Equivalent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What you have

if ( ($current_page == $saved_page) and ($current_ip == $saved_ip) and
($current_dt < ($saved_dt + 3600)) ) {
        return;
} else {
        $query  = "UPDATE `table` SET `hits` = '$count', `agent` =
'$agent', `ts` = '$date_time'  WHERE `page` = '$page'";
        $result = mysql_query($query) or die ('Error! -- ' . mysql_error());
}

is the same as writing it as

if ( ($current_page == $saved_page) && ($current_ip == $saved_ip) &&
($current_dt < ($saved_dt + 3600)) ) {
        return;
}

$query  = "UPDATE `table` SET `hits` = '$count', `agent` = '$agent', `ts` =
'$date_time'  WHERE `page` = '$page'";
$result = mysql_query($query) or die ('Error! -- ' . mysql_error());



On Mon, Mar 11, 2013 at 5:48 PM, Angela Barone
<angela@xxxxxxxxxxxxxxxxxxxx>wrote:

> On Mar 11, 2013, at 2:38 PM, Jonathan Sundquist wrote:
>
> Since you already have the return statement with the if statement the else
> isn't required. If those three statements are true you would exit the call
> any ways
>
>
> I don't follow.  The else contains the meat of the statement.
>
> Angela
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux