Re: UNLESS Statement Equivalent
| From: | Jonathan Sundquist | Date: | Mon, 11 Mar 2013 22:55:41 +0000 |
| Subject: | Re: UNLESS Statement Equivalent | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320474@lists.php.net to get a copy of this message | ||
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@italian-getaways.com>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
>