RE: [PHP] Logic
| From: | Martin Towell | Date: | Wed, 05 Dec 2001 01:58:02 +0000 |
| Subject: | RE: [PHP] Logic | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-76634@lists.php.net to get a copy of this message | ||
now change || to && and see if that does the job
-----Original Message-----
From: Dan McCullough [mailto:McWC@rocketmail.com]
Sent: Wednesday, December 05, 2001 12:57 PM
To: PHP General List
Cc: Richard S. Crawford
Subject: Re: [PHP] Logic
that didnt work,i started off with
if ($type != "add") {
that works
} else {
this works
}
I have done this before I'm just having a brain cramp.
if (($type != "add") || ($type != "edit") || ($type != "delete")) {
print $subcat_output;
} else {
print "<TR><TD BGCOLOR=\"#F7F7F7\"
WIDTH=\"20%\"></TD><TD
BGCOLOR=\"#F7F7F7\" WIDTH=\"80%\"><FONT
FACE=\"Verdana, Arial, Tahoma\" SIZE=\"2\" COLOR=\"#000000\"><a
href=".$PHP_SELF."?area=subcategory>Back to List of
Subcategories</FONT></TD></tr>";
}
--- "Richard S. Crawford" <rscrawford@mossroot.com> wrote:
> You need parentheses around the entire antecedent:
>
> if (($type !="add") || ($type !="edit") || ($type !="delete")) {
> //etc
>
> ^------- Note these parentheses---------------------------^
>
> Hope that helps.
>
>
> At 05:28 PM 12/4/2001, Dan McCullough wrote:
>
> >Question. I am trying to check to see if a certain piece of code should
> >be run. Here is an
> >example.
> >if ($type != "add") || ($type != "edit") || ($type !=
> >"delete") {//if
this
> >or this or this then
> >then run this code
> >} else {
> >then run this
> >}
> >
> >Is this correct, for some reason this isn't working.
>
>
> Sliante,
> Richard S. Crawford
>
> http://www.mossroot.com
> AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford
> MSN: underpope@hotmail.com
>
> "It is only with the heart that we see rightly; what is essential is
> invisible to the eye." --Antoine de Saint Exupéry
>
> "Push the button, Max!"
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
=====
dan mccullough
--------------------------------------------------------
"Theres no such thing as a problem unless the servers are on fire!"
__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net