Forum Moderators: coopster
in the script below, at "if ($b)" I need both $b and $c from the iteration before $b is established. How can I get both variables $b and $c available in "if ($b)" part of the script?
In some cases $b may have more than one example, only one of which is relevant, right now it is printing all examples, not just the relevant example.
If ($a)
{
mysql_query(WHERE id=$a)
print"$a";
}
if ($b)
{
mysql_query(WHERE id=$b
AND id2=$c)
while $result()
printf("<a href=\"%s?a=%s\">number $x </a>", $PHP_SELF, $a);
}
if ($c)
{
mysql_query( WHERE id=$c)
while $result()
printf("<a href=\"%s?b=%s\">number $y </a>", $PHP_SELF, $b);
}
else
{
mysql_query()
printf("<a href=\"%s?c=%s\">number $x </a>", $PHP_SELF, $c);
}
Thanks for your consideration.
D
I'm not sure what your question is, exactly, but the answer(s) above illustrate ways to include more than one comparison for any given action.
If your problem is that ALL of the comparisons are returning results, you may need to switch to:
if (..something..) {
}
elseif (..something else..) {
}
In this case, only one of the two comparisons will be run ... if ..something.. matches, the elseif will be ignored. If ..something.. does NOT match, only then will the elseif be examined.
Also, you should be using apostrophes to enclose the variable references if you are going to be using them in a mySQL query, i.e. mysql_query(WHERE id='$a')