RE: [PHP] question
| From: | Steve Bradwell | Date: | Wed, 04 Sep 2002 14:42:44 +0000 |
| Subject: | RE: [PHP] question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-115178@lists.php.net to get a copy of this message | ||
Maybe try somthing like this, write a function containing all your like
statements.
function likeStatements( ){
//write your statements in this function if they are always the same.
}
//then have an if structure like the following that calls that function in a
while loop.
if ( isset($a) && !isset($b) ){
while ($a){
likeStatements(); //you could also pass any needed info to the function.
}
}elseif( isset($b) && !isset($a) ){
while ($b){
likeStatements();
}
}elseif( isset($a) && isset($b) ){
while ($a && $b){
likeStatements();
}
}
HTH,
Steve.
-----Original Message-----
From: dorevh@tiscali.nl [mailto:dorevh@tiscali.nl]
Sent: Wednesday, September 04, 2002 10:26 AM
To: php-general@lists.php.net
Subject: [PHP] question
I have a php question.
I would like to enter a "while" loop, but:
I want it to be like this:
when $a has a value, while $a...
when $b has a value, while $b... (same statements as with $a)
when $a has a value, and $b has a value, while $a and $b
this is based on a search system in which the user can enter a, b or a and
b.
Can you help me with my problem, or help me find someone who can?!
Thanks.
Dore van Hoorn.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php